Saturday, February 18, 2012

the-object-has-been-updated-by-another-user-since-it-was-last-fetched/

Share/Save/Bookmark


the-object-has-been-updated-by-another-user-since-it-was-last-fetched/

You may be victim of this error when trying to update the content types with a code similar as below ,

SPContentType ct = web.ContentTypes[contentType];
ct.FieldLinks.Add(new SPFieldLink(field));
ct.Update(true);
web.Update();

To get rid of this error, get the new instance of the SPWeb object instead of using the one from SPContext.Current.Web or from feature properties.
If it still did not work then perhaps you may be updating content types in an enumeration for which you should try using new web object for each content type update.



 Subscribe

2 comments: