2

When I use Item.Update there is an error while updating the item, producing the following trace: Name :XYZ.xml Microsoft.SharePoint.SPException: The file ABC/EFD/CC Approver 1/XYZ.xml has been modified by SHAREPOINT\system on 08 Jan 2015 10:28:56 -0800. ---> System.Runtime.InteropServices.COMException (0x81020037): 0x81020015The file ABC/EFD/CC Approver 1/XYZ.xml has been modified by SHAREPOINT\system on 08 Jan 2015 10:28:56 -0800. at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bPreserveItemUIVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback) at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bPreserveItemUIVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback) --- End of inner exception stack trace --- at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx) at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bPreserveItemUIVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback) at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents, String filename, Boolean bPreserveItemUIVersion) at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents, String filename, Boolean bPreserveItemUIVersion) at Microsoft.SharePoint.SPListItem.Update() at Edwards.Global.JDAExtractor.Program.<>c__DisplayClass2.b__0() at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.b__2() at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) at Edwards.Global.JDAExtractor.Program.Main(String[] args)

While searching for answers, many people suggest to use Item.SystemUpdate instead. What's the difference between Item.SystemUpdate and Item.Update?

5
  • 5
    I am not sure why you are facing this error. Update() method saves the changes to the item, and also updates the time stamp, last modified by and increases the versions (if enabled). Using SystemUpdate() you can save the changes to an item without changing the Last Modified, Last Modified By and Verions (if enabled).
    – Ram
    Jan 27, 2015 at 7:01
  • What's the actual Error? There's a trace but you've cropped off the actual error message from the top.
    – James Love
    Jan 27, 2015 at 14:24
  • Here i have added the file log file can any one suggest me Jan 28, 2015 at 5:35
  • Are you checking the item in before using Update()? Are you running any workflows on the list that are triggered by ItemAdded or ItemUpdated?
    – thanby
    Jan 28, 2015 at 14:05
  • No I just updating a field in that list? Jan 29, 2015 at 4:58

2 Answers 2

1

As stated by @Ram in the comments, the difference between the two methods is that Update() modifies the item's timestamps and version whereas SystemUpdate() simply applies the changes without making the item appear to be modified.

This is useful for items that need to be administratively changed without affecting the record of their change. For example, if you have a list that you've added a new column to and need to programmatically update that column for all items in the list, but you don't want to trigger any alerts that users have place on it, using SystemUpdate() will help you do so "stealthily" to keep from flooding people's inboxes and polluting the items' metadata. For reference, here is the MSDN article on SystemUpdate.

As far as the error you're experiencing, that just shows the location of the exception but you've actually left out the exception itself. I've never run into a situation where Update() didn't work and SystemUpdate() did, but there's no harm in you trying it out to be sure. If it still doesn't work, post a new question with the full exception and ask for help resolving it.

0

Check this, mentioned in detailed..

http://www.moresharepoints.blogspot.in/2015/01/update-vs-systemupdate-in-sharepoint.html

PCM

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.