Citizen Developer
Zeitspanne
explore our new search
How to SharePoint Files & Folders to New Library with Power Automate
Power Automate
3. Dez 2023 17:00

How to SharePoint Files & Folders to New Library with Power Automate

von HubSite 365 über Dhruvin Shah [MVP]

Microsoft MVP (Business Application & Data Platform) | Microsoft Certified Trainer (MCT) | Microsoft SharePoint & Power Platform Practice Lead | Power BI Specialist | Blogger | YouTuber | Trainer

Citizen DeveloperPower AutomateLearning Selection

Automate SharePoint File Copy with Original Folder Structure using Power Automate—Master the Process!

Automating file management can often be a tedious task, but with powerful workflow automation tools, the process can be greatly simplified. Dhruvin Shah, a Microsoft Most Valuable Professional (MVP), offers a tutorial on how to copy files along with their folder structure from one SharePoint library to another. This process is crucial when a new file is added to a SharePoint folder, and a direct copy needs to be maintained in another document library.

The SharePoint connector within this automation tool provides a direct action called "Copy Files". However, this action does not maintain the original folder structure of the copied files. Dhruvin emphasizes the importance of recreating the file's folder structure in the target library before proceeding with the copy function. Let's explore the steps involved in accomplishing this with detailed guidance.

Here's a summarized guide outlining the process to copy a file and its folder structure using automation:

  • Trigger: Initialize the process with a trigger suited for file creation or modification in SharePoint.
  • Get File Properties: Retrieve the necessary properties of the newly created or modified file, particularly the file's path information.
  • Create Folder Structure: If the file's originating from a nested folder hierarchy, replicate this structure in your destination library using the "Create new folder" SharePoint action.
  • Copy File: Perform the file copying action referencing the file path acquired from the properties and the new folder path created.
  • Additional Logic (Optional): Implement any further logic if necessary, like metadata updates or notification alerts.

Note that there are operational limitations such as the maximum run duration and API call limits to consider when setting up your workflow, especially when dealing with a large volume of data. It is essential to incrementally build and rigorously test the workflow to ensure it operates as intended, reducing the risk of errors when automating file management tasks.

Testing every step of the automation is key, as it helps in identifying any potential issues that could hinder the reliability of the file copying process. Start simple, enhance gradually, and test meticulously for effective workflow automation.

Summarizing SharePoint File Copy in Power Automate

When a new file is added to a SharePoint folder, it's often necessary to replicate it elsewhere, retaining the original folder structure. This can be accomplished within Power Automate using the SharePoint connector. However, the "Copy Files" action provided doesn't maintain the folder hierarchy by default.

Therefore, to correctly duplicate the file's folder structure, we first need to ensure its hierarchy is replicated in the destination. Once this preparatory step is complete, we’re ready to proceed. The following details provide a high-level overview of the required process:

Understanding Power Automate for SharePoint File Management

Automation of file management tasks in SharePoint utilizing workflow automation tools like Power Automate can significantly enhance productivity. Users can automate the process of duplicating files and maintaining their folder structure in alternative locations, ensuring consistency and saving time that would otherwise be spent on manual copying. It is important to follow the process step by step, being aware of any system limitations and thoroughly testing to ensure proper implementation. With Power Automate, once the initial setup is completed, the workflow can handle file management tasks automatically, reflecting any additions or changes seamlessly in the designated library.

The provided text is a guide on how to copy a SharePoint file along with its folder structure to another library using Power Automate. The process requires understanding of specific actions within Power Automate like starting with a trigger, retrieving file properties, creating folder structure, and copying the file followed by any additional logic if needed. It is important to be aware of limitations such as run duration and API call limits within Power Automate and perform thorough testing. This function simplifies transferring files between SharePoint libraries while retaining their organizational structure.

People also ask SharePoint and Power Automate

How do I copy a folder structure from one SharePoint site to another?

To copy a folder structure from one SharePoint site to another, you must use Power Automate to create a flow. Begin by creating a list of the folder structure you need to copy using SharePoint or Power Automate's 'Get files (properties only)' action. Then use a combination of 'Create new folder' and 'Copy file' actions to replicate the structure in the new SharePoint site. Keep in mind you'll need to account for any existing content or unique permissions during this process.

How do I copy a folder and subfolder in Power Automate?

Copying a folder with its subfolders in Power Automate can be achieved by creating a recursive flow that first checks for subfolders within the parent folder. Use the 'Get files (properties only)' or 'Get folders' actions to identify all items within the parent folder. Then leverage 'Create new folder' in the destination location for each subfolder and use 'Copy file' action where necessary. The flow must handle each subfolder individually and recursively apply the same logic to copy their contents.

How do I export a folder structure from SharePoint?

Exporting a folder structure from SharePoint is not directly possible through the SharePoint interface. However, you can use Power Automate to generate a list of the folder hierarchy. The flow would use 'Get folder metadata' or 'Get files (properties only)' actions to retrieve the folders and their properties. You can then create a CSV file or a SharePoint list to save this data to document your folder structure. Another option is to manually document or use PowerShell scripts for more complex requirements.

How do I copy a SharePoint file in Power Automate flow?

To copy a SharePoint file in a Power Automate flow, start with the 'Get file content' or 'Get file content by path' action to retrieve the content of the file you want to copy. Then, use the 'Create file' action to create a new file in the destination library or folder path in SharePoint, providing the same file name and the file content retrieved from the previous action. Ensure you have the proper permissions on both the source file and destination library for the flow to execute successfully.

Understanding Workflow Automation in SharePoint

Achieving seamless workflow automation in SharePoint requires understanding of the specific tools and actions available within the platform. Workflow automation tools like Power Automate and their alternatives help in setting up complex tasks to run automatically, hence increasing efficiency and consistency in file management. Such automation ensures that every time a new file is created or updated in one SharePoint library, it can be replicated accurately in another, maintaining the file structure and metadata.

When properly implemented, these automated systems can save a significant amount of time and reduce the potential for human error, ensuring that document management across different libraries within SharePoint remains synchronized and current. Remember, as you encounter more complex requirements or larger datasets, a deep dive into the capabilities and constraints of your chosen automation tool will be crucial for successful process automation.

Power Automate - Copy SharePoint Files & Folders to New Library with Power Automate

Power Automate copy SharePoint files, SharePoint folder structure migration, SharePoint library file transfer, Power Automate SharePoint tutorial, Automate file copying SharePoint, SharePoint inter-library transfer, Power Automate folder copy, SharePoint file migration with Power Automate, SharePoint to SharePoint file transfer, Copy files to another library Power Automate