JDBC Driver for Microsoft SharePoint

Build 25.0.9434

DownloadAttachment

Downloads an attachment from a SharePoint list item. Useful for accessing and retrieving necessary documents.

Stored Procedure Specific Information

RemoteFile can be both relative to the server, or it can be the full URL of the file. Below are some examples:

EXECUTE DownloadAttachment File = 'C:/Users/User/Desktop/DownloadedFile.txt', RemoteFile = 'https://mysite.sharepoint.com/Lists/MyCustomList/Attachments/1/FileToDownload.txt';

EXECUTE DownloadAttachment File = 'C:/Users/User/Desktop/DownloadedFile.txt', RemoteFile = '/Lists/MyCustomList/Attachments/1/FileToDownload.txt';

Input

Name Type Required Accepts Output Streams Description
File String False False The local file path where the downloaded attachment will be saved. If not specified, the file content may be returned in FileData or written to a stream.
RemoteFile String True False The path of the file on the SharePoint server. Can be a full URL or just the file name. If only the name is provided, the latest version is downloaded.
Encoding String False False Specifies the character encoding format for the downloaded data. Determines how the data is read and processed.

The allowed values are NONE, BASE64.

The default value is BASE64.

FileStream String False True The output stream to which the downloaded attachment will be written. Used if File is not provided.
ReadTimeout String False False The maximum number of seconds allowed for the download operation. If exceeded, the operation fails, unlike Timeout, which only triggers if the download stalls.

Result Set Columns

Name Type Description
Success Boolean Indicates whether the attachment download operation was successful. Returns 'true' for success and 'false' for failure.
FileData String Contains the downloaded file content as binary data. Only returned if neither File nor FileStream is specified.

Copyright (c) 2025 CData Software, Inc. - All rights reserved.
Build 25.0.9434