ADO.NET Provider for Microsoft SharePoint

Build 25.0.9539

RenameAttachmentOrDocument

Renames an attachment or document stored in a SharePoint list or document library. Useful for standardizing naming conventions without affecting file content.

Stored Procedure-Specific Information

The RenameAttachmentOrDocument stored procedure renames a file or attachment in SharePoint. The SourceFileURL parameter specifies the path to the file to rename, and the NewFileName parameter specifies the new file name.

To rename a document in a SharePoint library, enter:

EXEC RenameAttachmentOrDocument List = 'Documents', SourceFileURL = '/Shared Documents/OldName.txt', NewFileName = 'NewName.txt';

The path specified in SourceFileURL should be relative to the URL connection property.

Input

Name Type Required Description
List String True The name of the SharePoint list or document library containing the document or attachment to be renamed.
SourceFileURL String True The relative URL of the file you want to rename, based on the site URL in the connection properties.

Example formats:
Root Directory file:/Shared Documents/filename.txt
Sub-directory file:/Shared Documents/MyFolder/filename.txt
If the connection property is set to a site collection, the relative URL corresponds to a path within the base site. If it points to a specific site, the relative URL is relative to that site.
NewFileName String True The new name for the file, including the file extension (such as 'UpdatedFilename.docx').

Result Set Columns

Name Type Description
Success Boolean Indicates whether the operation was successful. Returns 'true' if the file was renamed successfully, otherwise 'false'.

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