In last few posts I talked about how
to work on file versions using web service and using client object model. Those
posts described how to play around versions of file in document library. What
if I want to get, delete or restore versions of list item?
Obviously, first thing we will do is
to find any property related to version for “ListItem” class. But there
is no such property available. L
What to do now?
There is a simple way, use methods in
my last post and trick is to pass “fileUrl” parameter.
In case of file in document library, I
suggested to pass this parameter like:
"/sites/prasad/teamsite/MyLibrary/testexcel.xlsx"
For list item we have to tweak this
and pass “fileUrl” parameter as:
"/sites/prasad/teamsite/Lists/MyList/30_.000”
Here 30 is item id for item of
which I want to get version history.
Yes, we are good to go now. We can play around versions of list items also. Hurray!!!
Nice trick! But after getting the FileVersionCollection is there a way to convert a FileVersion (with limited properties) to a ListItem with all the properties of the item ? Thanks.
ReplyDeleteYou can get a hint in my previous article.
ReplyDelete