Power Automate / Flow - SharePoint: Automate File Movement to an Archive Library Tutorial
Learn to automate file movement in a SharePoint archive library using variables, conditional elements, and Power FX functions. Imagine maintaining source folder structure in the target library. Set up a recurring flow to retrieve and process files, and recreate the original structure in the archive library. This tutorial provides a comprehensive guide for efficient archiving between SharePoint libraries!
- 05:20
- 418 views
-
Excel - Cell references
- 1:34
- Viewed 4428 times
-
Excel - Freeze or lock panes
- 1:06
- Viewed 3911 times
-
Excel - How things are organized
- 1:58
- Viewed 4313 times
-
Excel - A closer look at the ribbon
- 3:55
- Viewed 4549 times
-
Excel - Start using Excel
- 4:22
- Viewed 4639 times
-
Excel - Microsoft Search
- 0:34
- Viewed 3582 times
-
Excel - Introduction to Excel
- 0:59
- Viewed 4247 times
-
Power BI - Introduction to Power Bi
- 1:29
- Viewed 7695 times
-
Remove a watermark
- 2:20
- Viewed 31128 times
-
Activate the features of Teams Premium
- 3:48
- Viewed 17275 times
-
Create a quick poll in Outlook with Microsoft Forms
- 3:38
- Viewed 14817 times
-
Collapsible headings
- 3:03
- Viewed 14004 times
-
Change the default font for your emails
- 1:09
- Viewed 13257 times
-
How do I prevent the transfer of an email?
- 2:07
- Viewed 12883 times
-
How to recall or replace a sent email in Outlook Web
- 0:53
- Viewed 12824 times
-
Protect a document shared by password
- 1:41
- Viewed 10981 times
-
Create automatic reminders
- 4:10
- Viewed 10822 times
-
Morph transition
- 0:43
- Viewed 9956 times
-
Remove a watermark
- 2:20
- Viewed 31128 times
-
Activate the features of Teams Premium
- 3:48
- Viewed 17275 times
-
Create a quick poll in Outlook with Microsoft Forms
- 3:38
- Viewed 14817 times
-
Collapsible headings
- 3:03
- Viewed 14004 times
-
Change the default font for your emails
- 1:09
- Viewed 13257 times
-
How do I prevent the transfer of an email?
- 2:07
- Viewed 12883 times
-
How to recall or replace a sent email in Outlook Web
- 0:53
- Viewed 12824 times
-
Protect a document shared by password
- 1:41
- Viewed 10981 times
-
Create automatic reminders
- 4:10
- Viewed 10822 times
-
Morph transition
- 0:43
- Viewed 9956 times
-
Copilot Agents: Analyst
- 03:05
- Viewed 33 times
-
Copilot Agents: Research
- 02:11
- Viewed 40 times
-
Create a Story with Copilot
- 01:19
- Viewed 34 times
-
Create a Draft with Copilot
- 01:35
- Viewed 39 times
-
Clean Up a Table with Copilot
- 01:33
- Viewed 31 times
-
Differentiate Between Copilot Versions
- 02:04
- Viewed 38 times
-
Decode the impact of your communication campaigns
- 02:51
- Viewed 142 times
-
Use Copilot to draft a communication
- 02:18
- Viewed 152 times
-
Create visuals without design skills
- 03:54
- Viewed 155 times
-
Create a brand kit to set the tone
- 03:21
- Viewed 221 times
Objectifs :
This tutorial aims to teach you how to automate the movement of files in a SharePoint archive library, taking into account various constraints. You will learn to use variables, conditional elements, and Power FX functions to create a recurring flow that organizes files based on their age while maintaining the original folder structure.
Chapitres :
-
Introduction to File Automation
Welcome to this tutorial where you will learn to automate the movement of files in an archive library. This process involves a more complex flow that must consider a series of constraints. -
Understanding the Task
In this video, you will use variables, conditional elements, and Power FX functions. Imagine needing to move files from a folder in a SharePoint library based on their age. The goal is to move these files while maintaining the source folder and file structure, ensuring an identical organization of your content in the target library, which is your archive library. -
Setting Up Your SharePoint Libraries
In this SharePoint site, you will find a standard library named 'Documents' containing a folder titled 'Files to Move.' This folder has a series of files of varying ages. Optionally, you can add a column for the file creation or modification date, which isn’t shown by default. Your second library, named 'Archives,' is currently empty and will need to be automatically populated. -
Creating a Recurring Flow
To begin, you will initiate a recurring flow that runs on the first of each month at 6 a.m. The first action will be to retrieve files from the folder containing potential files to be moved. While you could process the entire contents of your document library, this tutorial will focus on a specific folder. -
Configuring Advanced Settings
Enable advanced settings to apply a query that limits the flow to the chosen folder, including files in the subfolders. Enter the parameters related to nested items and specify the folder to be processed. In this example, you will only move files created two years ago or more. -
Setting Filter Criteria
The filter query will specify this criterion. Enter the name of the created column for the file creation date. You can also use 'modified' for the date of the last modification of the file. Set your criterion to 'le' (less than or equal) and enter an apostrophe to reference your deadline relative to the file creation date. -
Using Power FX Functions
Use the Power FX button to enter a formula that references the current date (UTC now) associated with the 'A day' function, defining minus 730 days (about two years). This will allow you to subtract 730 days from the current date. -
Processing Files
When SharePoint lists the files, it will include the names of the subfolders. To recreate the original structure in your archive library, constrain this action by adding a query parameter that excludes folder-type objects from the result. Initialize a text variable named 'folder' and populate it during future processing. -
Looping Through Files
Files dated over two years will be listed. Begin their processing by initializing an 'Apply to Each' loop that retrieves the dynamic content body value, which is the list of items to process. Within the loop, populate your 'folder' variable by retrieving the access path of each file. -
Managing File Paths
Choose the action related to variables to set your 'folder' variable. The access path of the file to be moved will contain the name of the library 'Shared Documents' and the subfolder 'Files to Move.' Use a Power FX formula to replace this path with empty space in your variable to retrieve only the relative path inside the folder to be processed. -
Handling Folder Structure
The last character of your 'folder' variable will contain a slash, which will cause an issue when moving the file to be archived. Use the 'slice' function to retrieve the path string from position index zero to index minus one, corresponding to the slash to be removed. If the file is at the root of your 'Files to Move' folder, the variable will contain empty space; otherwise, it will contain the path of the folder where the file is placed. -
Creating Folders in SharePoint
Manage an 'if' condition to test if the 'folder' variable is empty. If so, add the SharePoint action to create folders in your SharePoint site within your archives library, using the relative path of the folder corresponding to the file being processed. -
Moving Files to Archive
After creating or not creating the folder, still within the loop, add the action to move the processed file. Refer to the file to be moved by its complete original path and set the destination folder corresponding to your archives library, followed by the path stored in your variable. If another file already exists, choose to replace it. -
Conclusion
Finally, save and test your flow. Files over two years old will be moved to the root of your archives library, and for files stored in subfolders, the original structure will be recreated. This is how to create a complete archiving flow between SharePoint libraries.
FAQ :
What is the purpose of automating file movement in SharePoint?
Automating file movement in SharePoint helps maintain organization, ensures timely archiving of old files, and reduces manual effort in managing file storage.
How do I set up a recurring flow in Power Automate?
To set up a recurring flow in Power Automate, you can use the 'Recurrence' trigger, specify the frequency (e.g., monthly), and set the time for the flow to run.
What are Power FX functions?
Power FX functions are formulas used in Microsoft Power Platform to perform calculations, manipulate data, and automate tasks within applications.
How can I filter files based on their creation date in SharePoint?
You can filter files based on their creation date by using a filter query in your flow that specifies the date criteria, such as files created two years ago or more.
What should I do if a file already exists in the destination folder?
If a file already exists in the destination folder, you can choose to replace it during the file movement process in your flow.
Quelques cas d'usages :
Automating Document Archiving
In a corporate environment, a company can automate the archiving of old project files from a SharePoint library to an archive library. By setting up a flow that runs monthly, the company ensures that all files older than two years are moved, maintaining the original folder structure, which helps in easy retrieval of archived documents.
Managing Compliance Records
A legal firm can use this automated flow to manage compliance records by moving files that are no longer active to an archive library. This helps in keeping the active library clutter-free while ensuring that all compliance documents are stored securely and can be accessed if needed.
Streamlining File Organization
An educational institution can implement this flow to regularly archive student records and course materials that are no longer in use. By automating the process, the institution can ensure that their document library remains organized and that important historical data is preserved in an accessible manner.
Glossaire :
SharePoint
A web-based collaboration platform developed by Microsoft that integrates with Microsoft Office. It is used for storing, organizing, sharing, and accessing information from any device.
Power FX
A low-code programming language used in Microsoft Power Platform to create custom business logic and automate processes.
Flow
A feature in Microsoft Power Automate that allows users to automate workflows between applications and services.
UTC
Coordinated Universal Time, a time standard that is the basis for civil timekeeping worldwide.
Variable
A storage location identified by a name that can hold data which may change during the execution of a program.
Loop
A programming construct that repeats a block of code as long as a specified condition is true.
If Condition
A conditional statement that executes a block of code if a specified condition is true.
Folder Structure
The organization of folders and subfolders within a file system, which helps in managing and locating files.
Filter Query
A set of criteria used to limit the data retrieved from a database or service based on specific conditions.
Cette formation pourrait intéresser votre entreprise ?
Mandarine Academy vous offre la possibilité d'obtenir des catalogues complets et actualisés, réalisés par nos formateurs experts dans différents domaines pour votre entreprise