GETVERSIONS

Used to list all versions of a specific document in a document library.

Syntax

resultset GETVERSIONS(string listName, string file);

Return value

The procedure returns a list of versions with the following columns.

Column.NET Data TypeDescription
Version System.String Version number, e.g. "1.0". Current version always starts with '@'.
Url System.String The full URL of the document version
Created System.DateTime Date of creation
CreatedBy System.String Name of creator
Size System.String Size of document
Comments System.String Optional comments provided by the creator

Example: to get all versions of document Cats.docx from folder Latest in library Animals:

CALL GETVERSIONS('Animals', 'Latest/Cats.docx');

Code examples

Get document versions

using (var connection = new SharePointConnection(connectionString))
{
    connection.Open();
    using (var command = new SharePointCommand(@"CALL GETVERSIONS('Shared Documents', 'Images/bendsoft.jpg')", connection))
    {
        using (var reader = command.ExecuteReader())
        {
            while (reader.Read())
            {
                Console.WriteLine("Version: " + reader["Version"].ToString());
                Console.WriteLine("Created: " + reader["Created"].ToString());
                Console.WriteLine("CreatedBy: " + reader["CreatedBy"].ToString());
            }
        }
    }
}

Code result

Version: @1.0
Created: 2013-01-01 12:34:22
CreatedBy: John Smith


Skip Navigation Links.

Visa     MasterCard