CHECKOUT

Used to check-out a file in a document library.

Syntax

bool CHECKOUT(string listName, string file, bool offlineEditing [, datetime lastModified]);

offlineEditing: Boolean value that indicates whether the file is to be flagged as checked out for offline editing.

lastModified: Optional value representing the date and time of the last modification of the file. If this value is provided, the server compares the submitted value with the local last modified date. If the values do not match, the check-out fails and this procedure returns false.

Return value

The procedure returns true if operation succeeds, otherwise false.

Example: to check-out the file named helloworld.txt in document library Shared Documents:

CALL CHECKOUT('Shared Documents', 'helloworld.txt', true);

Example: to check-out the file named helloworld.txt in document library Shared Documents, provided that the file has not changed since known date and time:

Check-out document

var lastModified = new DateTime();
using (var connection = new SharePointConnection(connectionString))
{
    connection.Open();
    using (var command = new SharePointCommand(@"CALL CHECKOUT('Shared Documents', 'helloworld.txt', true, @lastmodified)", connection))
    {
        command.Parameters.Add("@lastmodified", lastModified);
        var ret = (bool)command.ExecuteScalar();

        if (ret)
            Console.WriteLine("Check-out succeeded");
        else
            Console.WriteLine("Check-out failed");
    }
}

Code result

Check-out succeeded


Skip Navigation Links.

Visa     MasterCard