Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is it possible to get metadata information from a previous version of a document in a document library using a SharePoint webservice?

I know I can use the _vti_bin/Versions.asmx webservice to get information about a previous version, but can I get the previous versions metadata?

If it's not possible through webservice is it possible using Client Object Model?

share|improve this question
    
Vedran, I need to get title of item for all versions? when i use the above method and mention title as field name , it returns collection of child nodes of all the items . So how do we get to know which title is belonging to which version? –  Harika Kakkireni Nov 18 '13 at 21:47
add comment

1 Answer

up vote 4 down vote accepted

Versions web service is no use in your case. You need to use Lists web service (http:///_vti_bin/lists.asmx) and Lists.GetVersionCollection Method

Returns version information for the specified field in a SharePoint list.

So you need to query field by field and as far as I know there is no method to return all field versions at once.

Your code could look something like this:

WSLists.Lists listService = new WSLists.Lists();
listService.UseDefaultCredentials = true;
XmlNode result = listService.GetVersionCollection(
    "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "[ITEM ID]", "[FIELD NAME]");
string outerXml = result.OuterXml;

and outerXML looks something like this:

<Versions xmlns="http://schemas.microsoft.com/sharepoint/soap/">
  <Version [FIELDNAME]="[VALUE]" Modified="[TIMESTAMP]" Editor="[USER]" />
  .
  .
  .
</Versions>

I never used this approach but I did some tests (on SP 2010 - but I don't think there is difference). I never found good way to easily get all fields for all versions.

And Client Object Model is SP 2010 feature only but except of FileVersion Class I don't see anything similar to 'Get me item versions with metadata'.

share|improve this answer
    
Thank you Vedran. That worked just perfect! –  Jonas Engdahl Sep 23 '11 at 14:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.