Used to delete a specific version of a specific document in a document library.


resultset DELETEVERSION(string listName, string file, double version);

Return value

After deletion the procedure returns a list of remaining 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 delete version 2.0 of document Cats.docx from folder Latest in library Animals:

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

Code examples

Delete document version

using (var connection = new SharePointConnection(connectionString))
    using (var command = new SharePointCommand(@"CALL DELETEVERSION('Shared Documents', 'Files/Serverlist.txt', 2.0)", 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: @3.0
Created: 2013-01-12 16:01:12
CreatedBy: Adam Sandler
Version: 1.0
Created: 2013-01-12 07:16:26
CreatedBy: Abe Lincoln

Skip Navigation Links.

Visa     MasterCard