UploadDocument
Uploads a document to a SharePoint document library. Essential for adding new files to SharePoint for collaboration and storage.
Stored Procedure-Specific Information
To execute this procedure, enter:EXEC UploadDocument RelativeUrl='Shared Documents/MyFolder/', InputFilePath='C:\path\to\local_file.txt', FileName='my_file.txt'
Input
| Name | Type | Required | Accepts Input Streams | Description |
| RelativeUrl | String | True | False | The relative path of the folder where the file will be uploaded. This path is based on the base URL specified in the SharePoint connection properties. Examples: Root folder:Shared Documents Sub-folder:Shared Documents/MyFolder If the connection property points to a site collection, the relative URL corresponds to a path on the base site. If it points to a specific site, the relative URL is relative to that site. |
| InputFilePath | String | False | False | The local file path of the file to be uploaded to SharePoint. |
| FileName | String | True | False | The name of the file to be created in SharePoint, including its file extension (such as 'Report.pdf'). |
| Overwrite | String | False | False | A Boolean value specifying whether to overwrite an existing file with the same name. Set to 'true' to replace the file if it exists. |
| Content | String | False | True | The file content as an InputStream. This parameter is used when InputFilePath is not specified. |
| FileData | String | False | False | The file content encoded as a string. Used as an alternative to InputFilePath and Content. When specified, no disk access is required. The encoding type must match the Encoding parameter. |
| Encoding | String | False | False | Specifies the encoding format of the FileData input. The default value is BASE64. Valid values are NONE and BASE64.
The default value is BASE64. |
| ChunkSize | Int | False | False | Defines the chunk size (in MB) for multipart uploads. This is useful for uploading large files in smaller parts. |
Result Set Columns
| Name | Type | Description |
| Success | Boolean | Indicates whether the upload operation was successful. Returns 'true' for success and 'false' for failure. |
| Id | String | A unique identifier returned after successfully uploading the file. |