Microsoft Sharepoint icon

Microsoft Sharepoint

Consume Microsoft SharePoint API

Overview

The File → Rename operation in the Microsoft SharePoint n8n node allows you to rename a file stored within a specific SharePoint site. This is useful for workflows that require automated organization, standardization of file naming conventions, or updating filenames based on business logic.

Common scenarios:

  • Automatically renaming files after upload to follow a naming convention.
  • Renaming files as part of an approval or review process.
  • Batch-renaming files based on metadata or user input.

Example:
You have a document uploaded by users with generic names (e.g., "document.pdf"). After processing, you want to rename it to include the user's name and date (e.g., "JohnDoe_2024-06-01.pdf").


Properties

Name Meaning
Site ID The identifier or name of the SharePoint site where the file resides. Options may be preconfigured (e.g., "Financial").
Item ID The unique identifier of the file you wish to rename.
New Name The new name you want to assign to the file.

Output

The output will contain the updated file information as returned by the SharePoint API after the rename operation. The structure typically includes:

{
  "id": "string",           // The file's unique ID
  "name": "string",         // The new name of the file
  "webUrl": "string",       // URL to access the file in SharePoint
  ...                       // Other metadata fields provided by SharePoint
}
  • If an error occurs and "Continue On Fail" is enabled, the output will include an error field with the error message.

Dependencies

  • External Service: Requires access to Microsoft SharePoint.
  • Authentication: Needs valid OAuth2 credentials (microsoftSharepointOAuth2Api) configured in n8n.
  • n8n Configuration: Ensure the node has access to the correct SharePoint site and permissions to modify files.

Troubleshooting

Common Issues:

  • Invalid Site ID or Item ID: If the provided IDs are incorrect, the node will fail to find the file.
  • Insufficient Permissions: The connected account must have permission to edit/rename files in the specified site.
  • File Not Found: If the file does not exist, an error will be thrown.

Error Messages:

  • "The ID you provided does not belong to a file." – Ensure the Item ID refers to a file, not a folder or other resource.
  • "File name must be set!" – The "New Name" property cannot be empty.
  • API errors from SharePoint (e.g., 404 Not Found, 403 Forbidden) will be passed through; check your IDs and permissions.

Resolution Steps:

  • Double-check the Site ID and Item ID values.
  • Verify the connected account’s permissions.
  • Ensure the new file name is valid and not empty.

Links and References

Discussion