Used to delete all versions of a specific document in a document library. The current version will always remain after calling this procedure.


resultset DELETEALLVERSIONS(string listName, string file);

Return value

After deletion the procedure returns a list containing the current version only 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 all versions of document Cats.docx from folder Latest in library Animals:

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

Code examples

Delete all document versions

using (var connection = new SharePointConnection(connectionString))
    using (var command = new SharePointCommand(@"CALL DELETEALLVERSIONS('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: @5.5
Created: 2013-01-12 07:16:26
CreatedBy: Adam Sandler

Skip Navigation Links.

Visa     MasterCard