RenameAttachmentOrDocument
Renames an attachment or document in a SharePoint library. Useful for updating file names without affecting content. The path specified in SourceFileURL must be relative to what you have used in URL connection property.
Stored Procedure-Specific Information
Examples follow:To rename a document in a SharePoint library:
/* URL = https://mysite.sharepoint.com/sites/Subsite */ EXEC RenameAttachmentOrDocument SourceFileURL = '/Shared Documents/Source Folder/Subfolder/Original Document.txt', NewFileName = 'Renamed Document.txt';
To rename a document at the root of a library:
/* URL = https://mysite.sharepoint.com */ EXEC RenameAttachmentOrDocument SourceFileURL = '/Shared Documents/Dummy_23.txt', NewFileName = 'Dummy_00002.txt';
To rename a document in a nested folder structure within a site collection:
/* URL = https://mysite.sharepoint.com/sites/Subsite */ EXEC RenameAttachmentOrDocument SourceFileURL = 'Shared Documents/Test Folder 1/Test Nested Folder 1/Test Document 2.txt', NewFileName = 'Test Document 2 Renamed.txt';
Input
| Name | Type | Required | Description |
| SourceFileURL | String | True | The relative path of the file or attachment to be renamed. This path is relative to the base URL specified in the SharePoint connection properties. |
| NewFileName | String | True | The new name for the file, including the file extension (such as 'UpdatedDocument.pdf'). |
Result Set Columns
| Name | Type | Description |
| Success | Boolean | Indicates whether the rename operation was successful. Returns 'true' for success and 'false' for failure. |