name: copy-across-sites description: | Copy files or folders between SharePoint sites or document libraries. Use when the user asks "copy this file to another site", "duplicate this document to the other library", "copy from Site A to Site B", "replicate this folder to the team site", "clone this file to another SharePoint library", or "move this to another site" (cross-site move is copy + delete). license: MIT metadata: author: Troy Taylor version: "1.0" pattern: mutation cowork.category: Files cowork.icon: Copy
Copy Across Sites
- Identify the source item. If not already known, use
list_sites,list_drives, andlist_folderto navigate to the file or folder. Capture the sourcedrive_idanditem_id. - Identify the destination. Use
list_sitesandlist_drivesto find the target site and library. Uselist_folderto choose a destination folder. Capture thedest_drive_idanddest_folder_id. - Confirm the copy details with the user: source item, destination site/library/folder, and optional new name.
- Call
copy_itemwith the source and destination IDs. Optionally providenew_nameandconflict_behavior(rename, replace, or fail). - The copy runs asynchronously. Inform the user and offer to check progress.
- Use
check_copy_statuswith the returnedmonitor_urlto track progress. ReportpercentageCompleteandstatus. - Once complete, offer to generate a sharing link with
create_linkor set metadata withset_metadataon the copied item. - If the user wanted a cross-site move (not copy), offer to delete the original item after confirming the copy succeeded.