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, a distinguished professional, boasts an impressive track record as a Microsoft MVP, having achieved this prestigious recognition for the eighth consecutive year since 2015. With an extensive career spanning over 18 years, Adnan has honed his expertise in various domains, notably excelling in SharePoint, Microsoft 365, Microsoft Teams, the .Net Platform, and Microsoft BI. Presently, he holds the esteemed position of Senior Microsoft Consultant at Olive + Goose. Notably, Adnan served as the MCT Regional Lead for the Pakistan Chapter from 2012 to 2017, showcasing his leadership and commitment to fostering growth within the tech community. His journey in the realm of SharePoint spans 14 years, during which he has undertaken diverse projects involving both intranet and internet solutions for both private and government sectors. His impact has transcended geographical boundaries, leaving a mark on projects in the United States and the Gulf region, often collaborating with Fortune 500 companies. Beyond his roles, Adnan is a dedicated educator, sharing his insights and knowledge as a trainer. He also passionately advocates for technology, frequently engaging with the community through speaking engagements in various forums. His multifaceted contributions exemplify his dedication to the tech field and his role in driving its evolution.

Leave a Reply