DOWNLOAD

Used to download a file from a document library.

Syntax

byte[] DOWNLOAD(string listName, string file, [double version = 0]);

Example: to download the file named helloworld.txt from folder Textfiles in document library Shared Documents:

CALL DOWNLOAD('Shared Documents', 'Textfiles/helloworld.txt');

It is also possible to download a specific version of a document if versioning has been enabled on the document library. Available versions can be listed with the GETVERSIONS procedure.

Example: to download version 2.3 of the file named helloworld.txt from folder Textfiles in document library Shared Documents:

CALL DOWNLOAD('Shared Documents', 'Textfiles/helloworld.txt', 2.3);

The procedure returns a scalar byte array that can be written to disk.

Example: to download binary content, such as a png image, simply use:

Download document

using (var connection = new SharePointConnection(connectionString))
{
    connection.Open();
    using (var command = new SharePointCommand(@"CALL DOWNLOAD('Shared Documents', 'Images/bendsoft.jpg')", connection))
    {
        byte[] data = (byte[])command.ExecuteScalar();
        Console.WriteLine("Date length = " + data.Length);
    }
}

Code result

Date length = 20140


Skip Navigation Links.

Visa     MasterCard