Sharepoint Error: Save Conflict Your changes conflict with those made concurrently by another user

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);
        }

Advertisement

3 Responses to “Sharepoint Error: Save Conflict Your changes conflict with those made concurrently by another user”


  1. 1 Amit Phule June 1, 2011 at 5:10 am

    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.

  2. 2 Nikola July 14, 2011 at 5:32 pm

    Great post this helped me alot with the Save Conflict errors in my custom workflow/

  3. 3 brsarruda January 26, 2012 at 6:48 pm

    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…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s





Follow

Get every new post delivered to your Inbox.