MS OneDrive Business icon

MS OneDrive Business

Access MS OneDrive for Business and SharePoint

File → Rename

AI-generated

Summary

Rename a file in OneDrive or SharePoint.

Inputs

  • driveType — Type of drive to access – User Drive, SharePoint Site Drive, or Shared Folder (Link).
  • sharedLinkUrl (required) — Paste the sharing link of the shared folder (right‑click → Share → Copy link). Required when driveType is Shared Folder (Link).
  • userId — User email or ID; leave empty to use the authenticated user from your credential.
  • siteId (required) — The SharePoint site to access; select from list or provide ID/URL.
  • fileSelection — How to specify the file – Browse, By Path, By ID, or By Sharing Link.
  • fileSharingUrl (required) — Paste the sharing link copied from OneDrive or SharePoint; required when fileSelection is By Sharing Link.
  • browseFolder1 — Choose from the list, or specify an ID using an expression; first browsing level.
  • browseFolder2 — Select a folder to go deeper; shown only if Level 1 is a folder.
  • browseFolder3 — Select a folder to go deeper; shown only if Level 2 is a folder.
  • browseFolder4 — Select a folder to go deeper; shown only if Level 3 is a folder.
  • browseFolder5 — Select a file to finish; shown only if Level 4 is a folder.
  • filePath (required) — The file to operate on; select from list, specify a path, or provide a file ID.
  • fileId (required) — The unique ID of the file; required when fileSelection is By ID.
  • newName (required) — The new name for the file.

Output shape

A single file object representing the renamed file (or the Graph response payload).

Returns the updated file metadata on success; errors are thrown if the rename fails or required inputs are missing.

Examples

Example 1: Rename a file selected via the file browser.

driveType = user, fileSelection = browse, filePath = (choose file), newName = 'new_name.txt'

Example 2: Rename a file using its unique ID.

driveType = user, fileSelection = id, fileId = '01ABC...', newName = 'renamed.pdf'

Example 3: Rename a file accessible via a sharing link.

driveType = sharedLink, sharedLinkUrl = 'https://.../folder', fileSelection = link, fileSharingUrl = 'https://.../file', newName = 'updated.docx'

Links

Discussion