ADO.NET Provider for Microsoft SharePoint

Build 25.0.9540

DownloadDocument

SharePoint ドキュメントライブラリからドキュメントをダウンロードします。ユーザーがオフラインコピーを取得したり、外部でドキュメントを処理したりできるようにします。RemoteFile は、ライブラリに対する相対パス、またはファイルの完全なURL のいずれかとして指定できます。

Stored Procedure-Specific Information

Examples follow.

To download a file to a local path:

EXEC DownloadDocument
  File = 'C:/Users/User/Desktop/DownloadedFile.txt',
  Library = 'Shared Documents',
  RemoteFile = '/newFolder/FileToDownload.txt';

To download with a full URL, specify the complete URL for the remote file:

EXEC DownloadDocument
  File = 'C:/Users/User/Desktop/DownloadedFile.txt',
  Library = 'Shared Documents',
  RemoteFile = 'https://mysite.sharepoint.com/Shared Documents/newFolder/FileToDownload.txt';

To download file content as base64-encoded data instead of saving to disk:

EXEC DownloadDocument
  File = '',
  Library = 'Shared Documents',
  RemoteFile = 'test/qbxls.txt';
Note: When neither File nor FileStream is specified, content is pushed to the FileData output.

To download file content without encoding:

EXEC DownloadDocument
  File = '',
  Library = 'Shared Documents',
  RemoteFile = 'test/qbxls.txt',
  Encoding = 'NONE';

Input

Name Type Required Accepts Output Streams Description
File String False False ダウンロードされたドキュメントが保存されるローカルファイルパス(ファイル名を含む)。例:'C:/Users/User/Desktop/DownloadedFile.txt'。
Library String False False ファイルがダウンロードされるSharePoint サーバー上のドキュメントライブラリの名前。例:'Shared Documents'。
RemoteFile String True False ライブラリ内のファイルの相対パスまたは完全なSharePoint URL。取得する正確なファイルを決定します。
Encoding String False False ダウンロードされたデータの文字エンコード形式を指定します。データの読み取りと処理方法を決定します。

使用できる値は次のとおりです。NONE, BASE64

デフォルト値はBASE64です。

FileStream String False True ダウンロードされたドキュメントが書き込まれる出力ストリーム。File が指定されていない場合に使用されます。
ReadTimeout String False False ダウンロード操作に許可される最大秒数。この時間を超えると操作は失敗します。Timeout とは異なり、ダウンロードが停止した場合のみトリガーされます。

Result Set Columns

Name Type Description
Success Boolean ドキュメントのダウンロード操作が成功したかどうかを示します。成功の場合は'true'、失敗の場合は'false' を返します。
FileData String ダウンロードされたファイルコンテンツがバイナリデータとして含まれます。File もFileStream も指定されていない場合にのみ返されます。

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