In SharePoint Online you can copy files from one library to other library within the same site or a different site but that would be a very manual process. Today I am sharing you two different activities with Power Automate which could help on copying files from one location to other.

Scenario

There could be different scenarios where file copy would be required, I am just taking a simple scenario where marketing department or an event team have to copy power Point template to multiple locations whenever they upload it to a specific folder. I have created a Marketing Document library which have a folder Final. Whenever a file is copied to that folder, a Power Automate flow will copy it in two different locations. For destination location, I have created a document library Destination and created two folders Copy 1 and Copy 2.

Power Automate Flow

I have created a Flow to be started whenever a new file is added to the Final folder in Marketing Library.

When a file is uploaded to the folder, it will start the workflow. The above property will return couple of file properties including File Identifier.

Now add a new activity to Get the Content to retrieve the file content, it can be retrieved using x-ms-file-id property.

The above property would be required for creating a new file and a specific path. Now will add the Create File activity, where we can define the site url and folder path. And it would need File Name and File content which we fetched from the Get File Content activity in previous step.

This activity will create the file on given path in destination library. Now will add the Copy File activity which would require the current site addersss and File to copy where you can pass the File Identifier which we can retrieve from the first activity property x-ms-file-id. After that we need to provide the Destination site address and Destination Folder path. I have added Replace but you can select a different option as per need if another file already exists with the same name.

Save the Power Automate Flow and copy a file in Final folder under Marketing library and this flow will add the copy of the file in Copy 1 and Copy 2 folders of Destination library.

Adnan is six time Microsoft MVP (Since 2015) with over 16 years of extensive experience with major expertise on SharePoint, SharePoint based development, Microsoft 365, Microsoft Teams, .Net Platform and Microsoft BI. He is currently working Sr Microsoft Consultant at Olive + Goose. He is MCT Regional Lead for Pakistan Chapter since 2012. He is working on SharePoint for past 12 years and worked on different intranet/intranet solutions for private & govt. sector majorly in United states and Gulf region and have experience of working with multiple Fortune 500 companies. He is a trainer, technology evangelist and also speaks in community forums.

Leave a Reply