OneDrive/SharePoint — Copy
OneDrive/SharePoint — Copy
Section titled “OneDrive/SharePoint — Copy”Type: msfiles-copy · Package: OneDrive / SharePoint v1.0.5
Creates a copy of a file or folder in the drive. You can choose the copy’s name and the target folder; ideal for generating a new document from a template.
How it works
Section titled “How it works”It works on the session created with OneDrive/SharePoint — Connect. Pass it in the session parameter, or place this activity inside the body of Connect to inherit it automatically.
By default the copy keeps the name and stays in the same folder; set name and folderId to change that. The target folder must be in the session’s drive. Copying a folder also copies all its content.
If you copy into the same folder without changing name, the copy clashes with the original’s name; always give a different name in that case.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | — | ID of the file or folder to copy. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanMicrosoftFilesSession | — | Connect session. Inherited inside Connect’s body. |
name | string | — | Name for the copy, with extension. When omitted, the original’s name. |
folderId | string | — | Target folder ID, in the same drive. When omitted, the original’s folder. |
Output
Section titled “Output”This activity does not return a value.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
No OneDrive/SharePoint session available. Provide 'session' from an msfiles-connect activity, or place this activity inside the Connect activity's body so the session is inherited automatically. | The activity is outside Connect’s body and did not receive session. Place it inside the body or pass session = session. |
'id' is required. | id is empty or its expression returned null. |
itemNotFound (Microsoft Graph, 404) | The item or the target folder does not exist in the session’s drive. |
accessDenied (Microsoft Graph, 403) | The connection cannot write to the target folder. |
Failures that happen while Microsoft 365 performs the copy (for example, a duplicate name) do not reach the activity; that is why it pays to confirm the copy appears before relying on it.
Example
Section titled “Example”Create a customer’s document from a template:
OneDrive/SharePoint — Connect credential = credential("m365-operations") └─ body: OneDrive/SharePoint — Copy id = templateId name = "Proposal " + customer + ".docx" folderId = proposalsFolderId Delay milliseconds = 5000 OneDrive/SharePoint — List files folderId = proposalsFolderId → output: proposalsRelated activities
Section titled “Related activities”- OneDrive/SharePoint — Move — move instead of copy.
- OneDrive/SharePoint — Create folder — create the target folder.
- OneDrive/SharePoint — List files — find the IDs.
- All OneDrive / SharePoint activities