MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

UpdateOverwriteVersion not working

  Asked By: Pallavi    Date: Nov 03    Category: MOSS    Views: 1787

The UpdateOverwriteVersion method of list item still creates a new
version, though it's not supposed to. Can anyone provide some info to get
this working? No good solutions from Google search.



7 Answers Found

Answer #1    Answered By: Irene Moss     Answered On: Nov 03

Can you use SPListItem.SystemUpdate()?

Answer #2    Answered By: John Scott     Answered On: Nov 03

I tried that also. It didn't work either.........

Answer #3    Answered By: Donald Torres     Answered On: Nov 03

When I have code that should attach but it does not then I open Event Handler
Explorer (U2U - Patrick Tisseghem) and look at the event receivers that are
attached to my lists. I sometimes find that I have event receivers attached even
when the feature is not installed or deployed. This tool allows me to remove the
attached event receiver and then I can deploy the corrected event receiver to my

I believe that there is a ghosted copy of the DLL that lives on the server even
when I have uninstalled a feature and its related DLLs. Therefore, even though
it appears to be a long way around to debug, my deployment strategy has always
been to:

1. Uninstall solution

2. IIS Reset

3. Clean solution

4. Build solution (NOT Rebuild!)

5. Deploy solution

6. Attach the debugger

7. Activate the feature

This has allowed me the most clean and responsive approach to ensuring that my
debugging strategy is working correctly. Sometimes, because I also use
WSPBuilder, the solution will activate automatically. In order for the debugger
to attach to the w3wp.exe process, I have to Deactivate solution and then
Activate it again. Then the debugger turns my breakpoints from hollow to solid

It's a big pain and I will probably turn it all into a post-build event script.
I just haven't taken the time to do all of that.

Answer #4    Answered By: Courtney Scott     Answered On: Nov 03

I also used U2U's Event Handler Explorer only. I am pretty sure
therez no problem with the dll caching or anything like that. Problem seems
to be in my logic. Any help to fix that would be great.

Answer #5    Answered By: Jagdeep Hor     Answered On: Nov 03

Make sure you aren't creating a new reference to SPWeb. If you already have a
"(using SPWeb)" you don't want to create another reference to a "(using SPWeb)"
because it will reopen the item and write it back anew.

This example is from the MSDN website
verwriteversion(office.12).aspx) for SPListItem.UpdateOverwriteVersion
using (SPSite sps = new SPSite("http://server/"))
using (SPWeb spw = sps.OpenWeb())
SPList spSharedDocs = spw.Lists["Shared Documents"];
SPListItem spli = spSharedDocs.Items[0];
spli["Created"] = new DateTime(2007, 1, 1);
spli["Author"] = "-1;#domain\\user";
spli["Editor"] = "-1;#domain\\user";
spli["Modified"] = new DateTime(2007, 2, 1);

Where is your code failing in your debugger?

Answer #6    Answered By: Aja Howe     Answered On: Nov 03

Thanks a lot. I will check that again and let you know. Anyways,
the code fails at the last line. The UpdateOverwriteVersion is creating a
new version. The code is not breaking, but it is behaving different.

Answer #7    Answered By: Anthony Rutledge     Answered On: Nov 03

I have had great luck with SPListItem.SystemUpdate() in doing this. I would look
further into that one, as well...

Didn't find what you were looking for? Find more on UpdateOverwriteVersion not working Or get search suggestion and latest updates.