Copy File or Folder
Prerequisite Permissions: For Copy File or Folder step in OneDrive following are the permissions needed.
| Permission type | Permission (from least to most privileged) |
|---|---|
| Delegated (work or school account) | Files.ReadWrite, Files.ReadWrite.All |
| Delegated (personal Microsoft account) | Files.ReadWrite, Files.ReadWrite.All |
Description
This step copies a file or folder from one OneDrive path to another. You provide the source path and the destination path. Use this step in workflows that duplicate templates, create backups of important files, or distribute copies across different folders.
Note:
- Support is provided for the Personal Drive, however, the displayed error message is not correct.
- When Rename value and non-existing Destination Folder Path is provided and Create Folder is No, then this step will execute successfully and rename the source item.
- When non-existing Destination Folder Path is provided, Create Folder is No and Rename value is not provided, then this step will abort with error 'The specified item name already exists.'.
Reference:
https://docs.microsoft.com/en-us/graph/api/driveitem-copy?view=graph-rest-1.0&tabs=http
Configurations
| No. | Field Name | Description |
|---|---|---|
| Configuration: | ||
| 1 | Step Name | Name of the step. This name has to be unique in a single workflow. |
| Connection: | ||
| 2 | Client ID | Select the client ID for which you want to copy a file or folder. Note: This field is mandatory for personal accounts. |
| 3 | Checkbox: Accept value as variable/static | Leave checkbox unchecked to accept Refresh Token value from a field in the previous steps of the stream using a drop down list. Else enable checkbox for Refresh Token field to appear as Text box. |
| 4 | Refresh Token | Specify the Refresh Token provided by authorization grant flow. The data type is String. This field is mandatory. |
| 5 | Button: Test Connection | Verifies whether the connection is established or not. |
| Input Tab | ||
| 1 | Source File Or Folder ID/Path | Provide OneDrive source file or folder ID or path to copy the file or folder to the destination. The field data type is String. This is mandatory. |
| 2 | Destination Folder ID/Path | Specify the OneDrive folder ID or path to copy the file or folder. The field data type is String. This is mandatory. To specify OneDrive Path: For example, OneDrive path = https://organization-my.sharepoint.com/personal/xyz/Documents/demofolder/File.xlsxProvide = demofolder/File.xlsxTo specify OneDrive Path to create folder: For example, OneDrive path = https://organization-my.sharepoint.com/personal/xyz/Documents/abcTo create root folder = Documents/newfolderTo create inner folder = abc/newfolder |
| 3 | File Or Folder Name After Copy (Rename) | Specify the name to rename the file or folder in the destination location. The field data type is String. |
| 4 | Create Folder (if not exists) | Specify the allowed values to perform the action of creating a folder. Allowed values are: Yes / No. |
Known Issues:
Sometimes, you may see a temporary error related to the internet connectivity and network issues. The issue arises when the hostname is unresolved and the local server does not receive a response from an authoritative server. For example, you may see any of the following messages:
- login.microsoftonline.com.
OR
- This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server (login.microsoftonline.com)