SharePoint - The object has been updated by another user since it was last fetched - while updating Site Columns
This is the second time I've been bitten by this error.
Exception:
The object has been updated by another user since it was last fetched
And both times I had forgotten why, and then panicked, then searched online, found articles talking about this, and figured it all out, only to recall in the last minute...
Hey, wait a minute, this happened before.
The story begins as soon as you are trying to update your site columns. Either via the web UI, or via code, or via PowerShell. And then you hit this error.
The cause:
This is most likely because you've created the site column using an invalid Schema XML, in particular, you've embedded the version field in the <Field> definition.
<Field Type="Text" DisplayName="OrganisationName" Required="FALSE" EnforceUniqueValues="FALSE" Indexed="FALSE" MaxLength="255" ID="{guid-xxx}" StaticName="OrganisationName" Name="OrganisationName" Version="1" ></Field>
The Version attribute could have got in via a number of means, but most likely you exported the existing Schema from somewhere and it got embedded.
My explanation:
When you update a site column, SharePoint expects that the version number of this site column object increments after the update. But because you are updating the site column via Schema and forcing the version to be fixed all the time, that number doesn't increment. SharePoint now thinks there's something really wrong.
The Fix:
Remove the Version attribute from the Field definition, and then redeploy that definition to the server.
<Field Type="Text" DisplayName="OrganisationName" Required="FALSE" EnforceUniqueValues="FALSE" Indexed="FALSE" MaxLength="255" ID="{guid-xxx}" StaticName="OrganisationName" Name="OrganisationName" ></Field>