While working on Power Automate, one of my clients needed to move files from one SharePoint tenant to another as part of a cross-organization collaboration project. They wanted an automated process to copy files without manual interaction.
In this tutorial, I will show you how to copy SharePoint files from one tenant to another tenant using Power Automate.
Copy SharePoint Files From One Tenant to Another Tenant Using Power Automate
Imagine you are part of a company that is merging with another organization. You must migrate files from a SharePoint document library in one Tenant, i.e., szg52, to a corresponding document library in another, i.e., tsinfotechnologies.
For example, files from the “Marketing Materials” library in Tenant szg52 must be copied to the “Marketing Resources” library in Tenant tsinfotechnologies.
Now follow the below steps:
1. In the Power Automate, click the Instant Cloud flow, enter the Flow name, and choose the trigger flow (i.e., manually trigger a flow).
2. Add Get files (properties only) and provide the below parameters to retrieve all files from the source document library in Tenant szg52:
- Site Address: Select the SharePoint site address, which, in my case, is PowerAutomateTutorial.
- Library Name: Select the SharePoint library name, which, in my case, is Marketing Material.
3. Add Get file content and provide the below parameters to extract the content of each file retrieved from the “Get files (properties only)” action:
- Site Address: Select the SharePoint site address, which, in my case, is PowerAutomateTutorial.
- File Identifier: Provide an Identifier from the dynamic content of Get files (properties only).
It will automatically add a For each action.
4. Inside For each loop, add the Create file action from the SharePoint connector, and before you provide the site address, click Change the connection.
5. Then click Add new -> Sign in to Tenant tsinfotechnologies using appropriate credentials.
6. After that, in the “Create file” action, enter the following parameters to create the file in the target library within the Tenant‘s tsinfotechnologies.’
- Site Address: Select the SharePoint site URL from the Tenant tsinfotechnologies.
- Folder Path: Select the folder path in the Marketing Resources library where you want to store the files.
- File Name: Use the File Name with Extension dynamic content from Get files (properties only):
@{item()?['{FilenameWithExtension}']}
- File Content: Use the File Content dynamic content from the Get file content action.
@{body('Get_file_content')}
Run the Flow to Copy SharePoint Files From One Tenant to Another Tenant
Now, click save and run the flow manually after it runs successfully. Then, go to the tsinfotechnologies SharePoint library (Marketing Resources), and you will see that the files have been copied.
Conclusion
In this tutorial, I explained how to automate copying files from one SharePoint tenant to another using Power Automate. We covered creating an Instant Cloud flow, retrieving files from the source document library in Tenant szg52, extracting their content, and then creating the files in the target document library in Tenant tsinfotechnologies while switching credentials between tenants.
Additionally, use the trigger if you need to copy a single file instead of multiple files. When a file is created or When a file is created or modified (properties only), use the trigger instead of manually triggering the flow. After setting up the Create file action, change the connection to the target tenant (tsinfotechnologies) and provide the appropriate file path, name, and content.
You may also like:
- Copy and Rename File in Power Automate
- Get SharePoint Multi-Select Choice Values in Power Automate
- Convert String to Decimal in Power Automate
- Send an Email With Options in Power Automate
- Send an Email with @mention in Power Automate
- Power Automate vs Nintex: Key Differences for Workflow Automation
- Create a SharePoint Online Communication Site Using Power Automate
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com