DownloadFile
Download an existing file from your drive.
Stored Procedure Specific Information
Microsoft OneDrive allows only a small subset of columns to be used in the Exec query. Either ResourcePath or ResourceId is required to download the file. These columns can typically be used with only = comparison.
If file is present in the root folder of a OneDrive account, then mention the file name directly for the value of ResourcePath.
For example:
EXECUTE DownloadFile ResourcePath = 'Book.xlsx', LocalFile = 'D:\\Desktop\\Book.xlsx'
If file is present inside a child folder of a OneDrive account, then you need to specify the path of the file starting from child folder name for the value of ResourcePath.
For example:
EXECUTE DownloadFile ResourcePath = 'Notebooks/test.png', LocalFile = 'D:\\Desktop\\test.png'
You can also download the file by just providing the ResourceId as well.
For example:
EXECUTE DownloadFile ResourceId = '01CYQN2MFPR6NIWVZNMNFL3SL4E3KF7IHY', LocalFile = 'D:\\Desktop\\test.png'
Input
Name | Type | Required | Accepts Output Streams | Description |
ResourcePath | String | False | False | The location of the resource. Either ResourceId or ResourcePath is required for this operation. |
ResourceId | String | False | False | The Id of the resource to be downloaded. Either ResourceId or ResourcePath is required for this operation. |
DriveId | String | False | False | The Id of the drive the resource is located in if this is different from the currrent user drive. |
LocalFile | String | False | False | The local file path including the file name for the location where the file will be saved on disk. Leave empty to keep the file in memory. |
Encoding | String | False | False | If the LocalFile input is left empty, the data will be output to FileData in the specified encoding.
The allowed values are NONE, BASE64. The default value is BASE64. |
Overwrite | String | False | False | What to do when downloaded file exists. Set true to overwrite. |
FileStream | String | False | True | An instance of an output stream where file data is written to. Only used if DownloadPath is not provided. |
Version | String | False | False | Mention the version of the file except for the latest. |
UserId | String | False | False | The Id of the user who created the file. Mention only if version is given |
Result Set Columns
Name | Type | Description |
FileData | String | If the LocalFile input is empty, file data will be output in the format specified by the Encoding input. |
Success | String | File download results. |