Cmdlets for Microsoft SharePoint

Build 25.0.9539

DownloadDocument

Downloads a document from a SharePoint document library. Helps users retrieve SharePoint-stored files for offline use or processing.

Stored Procedure-Specific Information

The DownloadDocument stored procedure downloads a document from a SharePoint document library. You can save the document to a local file using the File parameter, or retrieve the content as base64-encoded data using the FileData output.

To download a document to a local file, enter:

EXEC DownloadDocument Library = 'Shared Documents', RemoteFile = 'https://mysite.sharepoint.com/Shared%20Documents/test.txt', File = 'C:\path\to\DownloadDocument.txt';

To retrieve the document content as base64-encoded data, omit the File parameter:

EXEC DownloadDocument Library = 'Shared Documents', RemoteFile = 'https://mysite.sharepoint.com/Shared%20Documents/test.txt';

The RemoteFile parameter can be either a full URL or a relative path within the library.

Input

Name Type Required Description
File String False The local file path where the downloaded document should be saved, including the new filename. Example: 'C:/Users/User/Desktop/Document.docx'.
Library String True The name of the SharePoint document library from which the file will be downloaded. Example: 'Shared Documents'.
RemoteFile String True The path of the document on the SharePoint server. This can be either the full URL (such as 'https://yoursharepointsite.com/Shared Documents/document.docx') or just the file name. If only the name is provided, the latest version will be downloaded.

Result Set Columns

Name Type Description
Success Boolean Indicates whether the download operation was successful. Returns 'true' if successful, otherwise 'false'.
FileData String The BASE64 encoded content of the downloaded document. This is only returned if File and FileStream are not specified.

Copyright (c) 2026 CData Software, Inc. - All rights reserved.
Build 25.0.9539