Skip to main content

Copy file or folder

Copy a file or folder into another folder, optionally under a new name, and wait for the copy to finish.

Command in the Microsoft 365 toolkit · id ooa.microsoft365/copy_item · 9 inputs (2 required), 3 outputs

Inputs​

InputTypeRequiredDefaultWhat it is
Access tokenCredentialNoMicrosoft Graph access token from the vault; or leave it empty and choose a connection that signs in, which gets and renews the token.
ItemStringYesPath in the drive (e.g. Reports/q4.xlsx), or id:{item-id}.
To folderStringYesDestination folder path (empty for the root), or id:{item-id}.
New nameStringNoName for the copy; the original name when empty.
To driveStringNoDestination drive when different from the source drive.
Wait (seconds)NumberNo120How long to wait for the copy; 0 returns at once.
If existsStringNofailWhen the name is taken at the destination: fail, rename (add a number) or replace.
DriveStringNome/driveWhose files: me/drive (your OneDrive), a person (ann@acme.com), a SharePoint site (contoso.sharepoint.com:/sites/Finance), a library of a site by name (contoso.sharepoint.com:/sites/Finance:/Invoices), or sites/{site-id}/drive or drives/{drive-id}. With an app sign-in, name a person or site.
Endpoint addressStringNohttps://graph.microsoft.com/v1.0Graph endpoint; change only for national clouds or testing.

Outputs​

OutputTypeWhat it is
item_idStringId of the copy, once it has finished.
statusStringcompleted, or inProgress when the wait ran out.
monitor_urlStringAddress to check the copy's progress.