If you develop Sharepoint components that modify list items, you might know this error:
Save Conflict
Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes.
This happens whenever you try to save a SPListItem which has been modified since you opened it. Review your code to ensure that you don’t open the same list item multiple times, work with a single SPListItem object instead.
Sometimes however it is necessary to open the same list item in parallel, as example if you want to perform an operation with elevated privileges on the item. If you take this approach you need to ensure that if you save one of the SPListItem objects, you need to reload all other SPListItems that point to the same actual item. Otherwise you’ll get the error above whenever you perform a change on the outdated items.
You can use the following utility method to ease the reloading of items:
/// <summary>
/// Reload a list item from scratch
/// </summary>
/// <param name="item">The list item</param>
/// <remarks>
/// Useful to avoid save conflicts
/// </remarks>
/// <returns></returns>
public static SPListItem ReloadListItem(SPListItem item)
{
if (item == null)
return null;
return item.ParentList.GetItemByUniqueId(item.UniqueId);
}
Hi, this is a grate post.
I have written a function to update a list item. it gives SAVE CONFLICT error many times because may be many users are using this function.
How above solution make any difference? Because you are reading a list item again and going to update the same.
Please provide more clarification.
Thanks.
Great post this helped me alot with the Save Conflict errors in my custom workflow/
Thank you so much, I just solved with this part..
This happens whenever you try to save a SPListItem which has been modified since you opened it. Review your code to ensure that you don’t open the same list item multiple times, work with a single SPListItem object instead.
I inserted a submit data into the form load, then I removed, and it’s works without code behind…just review to avoid if open the list many time…