Wednesday 13 November 2013

How does the Sharepoint 2010 Client Side Object Model do its Optimistic Concurrency checking...

or "How can you check if a list item has been changed since you retrieved it?"

[Anyone who said to use the "Modified" date, go wash your mouth out!]
I'm pulling items out of lists in a WEB API service app and supplying the data to a client app in a custom format.
The client might pass data back requesting updates - but before I use the CSOM to perform the update I want to make sure that no-one else has updated the list-item in the meantime.
So bascically I want the equivalent of a Hibernate / nHibernate version property to pass / return / check over the wire.
Within your list-item you'll find the hidden field owshiddenversion .  That's the one whose value increments every time the list item is change.