Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
SDK Documentation
Web Services
Versions Class
Versions Methods
 GetVersions Method

  Switch on low bandwidth view
Community Content
In this section
Statistics Annotations (0)
Versions.GetVersions Method (Versions)
Returns information about the versions of the specified file.

Web Service: VersionsWeb Reference: http://<Site>/_vti_bin/Versions.asmx
Visual Basic (Declaration)
<SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/GetVersions", RequestNamespace:="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace:="http://schemas.microsoft.com/sharepoint/soap/", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function GetVersions ( _
    fileName As String _
) As XmlNode
Visual Basic (Usage)
Dim instance As Versions
Dim fileName As String
Dim returnValue As XmlNode

returnValue = instance.GetVersions(fileName)
C#
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/GetVersions", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
public XmlNode GetVersions (
    string fileName
)

Parameters

fileName

A string that contains the site-relative URL of the file in the form Folder_Name/File_Name.

Return Value

An XML fragment in the following form that can be assigned to a System.Xml.XmlNode object:
Xml
<results xmlns="http://schemas.microsoft.com/sharepoint/soap/">
   <list id="{26E516B0-8241-4B97-984D-000000000000}" />
      <versioning enabled="1" />
   <settings url="http://Server_Name/Site_Name/_layouts/
         1033/LstSetng.aspx?
      List={26E516B0-8241-4B97-984D-000000000000}" />
   <result version="@4" url="http://Server_Name/Site_Name/
         Shared Documents/File_Name.doc" 
      created="6/7/2003 5:55 PM" createdBy="DOMAIN\User" size="19968" 
         comments="" />
   <result version="1" url="http://Server_Name/Site_Name/
         _vti_history/1/Shared Documents/File_Name.doc" 
      created="6/7/2003 5:49 PM" createdBy="DOMAIN\User" size="19968" 
         comments="" />
      .
      .
      .
</results>

The filenName parameter provides both file name and relative folder location, in the form folder_name/file_name. Following are examples of this parameter:

  • document_library/file_name.ext

  • Shared Documents/File_Name.doc

The following code example displays information about the versions of a specified file.

This example requires that a using (C#) or Imports (Microsoft Visual Basic) directive be included for the System.Xml namespace.

Visual Basic
Dim versionService As New Web_Reference_Folder_Name.Versions()
versionService.Credentials = 
    System.Net.CredentialCache.DefaultCredentials

Dim ndVersions As XmlNode = 
    versionService.GetVersions("Shared Documents/File_Name")

MessageBox.Show(ndVersions.OuterXml)
C#
								Web_Reference_Folder_Name.Versions versionService = 
    new Web_Reference_Folder_Name.Versions();
versionService.Credentials= 
    System.Net.CredentialCache.DefaultCredentials;

XmlNode ndVersions = 
    versionService.GetVersions("Shared Documents/File_Name");

MessageBox.Show(ndVersions.OuterXml);
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker