Create, copy, move and remove SharePoint folders cross-site with the help of Microsoft Flow
This article will show how to use Microsoft Flow to create SharePoint folders in two ways, copy, move these folders to another site and remove the source folder after copying.
For example, we consider the following case. We need to create 2 folders in a document library, then move them to another site.
For the first folder, I will use Create SharePoint Folder by URL for creating the folder and Move SharePoint Folder from Library for moving it to a different site.
For the second folder, I will use Create SharePoint Folder in List for creating it. Then instead of moving it with a single action, I will copy this folder to another site by Copy SharePoint Folder from Library action and then remove the source folder by Remove SharePoint Folder by URL action.
All these actions are from Plumasail SP connector, which is a part of Plumsail Actions.
Before starting, ensure that you added Plumsail SP connector to Microsoft Flow.
This article is divided into cases:
- Creating a folder by URL and moving it to another site
- Creating a folder in a library, copying it to another site and removing the source library
Creating a folder by URL and moving it to another site
In this case, I created the flow based on ‘Create SharePoint Folder by URL‘ and ‘Move SharePoint Folder from Library‘ actions and configured it to start manually.
You can find more information about specific parameters of the flow actions in the documentation.
The complete flow is below:
Manually trigger a flow
For this case, I used the trigger to manually start the flow. You can use any other triggers available in Microsoft Flow.
Create SharePoint Folder by URL
In this action, I specified the following parameters:
‘Folder URL‘ as "https://contoso.sharepoint.com/sites/firstSubSite/Shared%20Documents/FirstFolder"
- The URL of the folder that I want to create. For this simple case, I used a raw link, but you can get it dynamically based on your logic. The new folder will be created in ‘Shared Documents‘ library and will be called ‘FirstFolder‘.
Note: You can create several folders with a single link. For example, if you specify the value for this field as"https://contoso.sharepoint.com/sites/firstSubSite/Shared%20Documents/FirstFolder/AnotheFolder"
then the action will create ‘FirstFolder‘ folder inside your destination library and ‘AnotherFolder‘ folder inside ‘FirstFolder‘.
‘SharePoint Site URL‘ as "https://contoso.sharepoint.com/sites/firstSubSite"
- The URL of the site.
Move SharePoint Folder from Library
For the ‘Source URL‘ parameter I used the value of the ‘Folder URL‘ parameter from ‘Create SharePoint Folder by URL‘ response:
‘Destination URL‘ is specified as "https://contoso.sharepoint.com/sites/secondSubSite/Shared%20Documents/"
- The URL of ‘Shared Documents‘ library on ‘secondSubSite‘ site (it is a target site for moving).
Note: If ‘Destination URL‘ ends with a slash '/' the folder will be placed in the folder or library without name changes. Otherwise, the folder will be renamed.
And finally, ‘SharePoint Site URL‘ is specified as "https://contoso.sharepoint.com/sites/firstSubSite"
- The URL of the site for the source folder.
Creating a folder in a library, copying it to another site and removing the source library
I
n this case, I created the flow based on ‘Create SharePoint Folder in List‘, ‘Copy SharePoint Folder from Library‘ and ‘Remove SharePoint Folder by URL‘ actions and configured it to start manually.
You can find more information about specific parameters of the flow actions in the documentation.
The complete flow is below. You can find step by step description next to the picture.
Manually trigger a flow
For this case, I used the trigger for manually start the flow. You can use any other triggers available in Microsoft Flow.
Create SharePoint Folder in List
In this action, I specified the following parameters:
‘Target List‘ as "Documents"
- The name of the document library where I want to create the folder.
Note: This action is most useful when you do not have the opportunity for getting the full URL of your document library or list because you can specify only the name or partial URL of the library or the list
‘Folder Path‘ as "SecondFolder"
- The path for the folder that will be created. It is a simple example with only one folder in the path. You can create several folders if you specify the value for this field, for example as "SecondFolder/AnotheFolder"
. The action will create ‘SecondFolder‘ folder inside your destination library and ‘AnotherFolder‘ folder inside ‘SecondFolder‘.
‘SharePoint Site URL‘ as "https://contoso.sharepoint.com/sites/firstSubSite"
- The URL of the site.
Copy SharePoint Folder from Library
As in the previous case, I used the value of ‘Folder URL‘ parameter from ‘Create SharePoint Folder in List‘ response as the value for ‘Source URL‘:
‘Destination URL‘ is specified as "https://contoso.sharepoint.com/sites/secondSubSite/Shared%20Documents/"
- The URL of ‘Shared Documents‘ library on ‘secondSubSite‘ site (it is a target site for copying the folder)
Note: If ‘Destination URL‘ ends with slash '/' the folder will be placed in the folder or library without name changes. Otherwise, the folder will be renamed.
‘SharePoint Site URL‘ as "https://contoso.sharepoint.com/sites/firstSubSite"
- The URL of the site for the source folder.
Remove SharePoint Folder by URL
In this action, I also used the value of ‘Folder URL‘ parameter from ‘Create SharePoint Folder in List‘ response as the value for ‘Source URL‘:
‘SharePoint Site URL‘ as "https://contoso.sharepoint.com/sites/firstSubSite"
- The URL of the site for the source folder.
This article was originally published here.
Comments
-
Create, copy, move and remove SharePoint folders cross-site with the help of Microsoft Flow
Hi @MauiRamirez,
Thank you for your comment and for the feedback.
We will try to make it more clear that it is a 30-day trial.
For now, you can see your license information in the "License" section of the account. Right below the "API Keys" section:
-
Create, copy, move and remove SharePoint folders cross-site with the help of Microsoft Flow
I am using one of your actions in a Flow to delete folders, and it works great. Unfortunately for me, I didn´t see that this was a pay for product and that I had started with a 30 days trial.
It stopped working after the trial period and I did´t find out what was happening after a while, some time later.
*This post is locked for comments