cancel
Showing results for 
Search instead for 
Did you mean: 

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:

 

Creating folder by URL and moving it to another site

 

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:

 

Folder Info Dynamic Content

 

‘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.

 

Creating a folder in a list, copying it to another site and remove the source folder

 

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‘:

 

Folder Info Dynamic Content

 

‘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‘:

 

Folder Info Dynamic Content

 

‘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

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.

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:

 

2018-06-01_12-07-17.png

Meet Our Blog Authors
  • Working daily with Microsoft Cloud to deliver the needs of my company, my customers and various Microsoft communities and forums. | Office 365 | Flow | PowerShell | PowerApps | SharePoint |
  • Co-founder of https://plumsail.com, Office 365 and SharePoint expert. Passionate about design and development of easy to use, convenient and flexible products.
  • Microsoft Business Apps MVP. Owner of ThriveFast, an Office 365 consulting company.
  • 7x Microsoft Business Solutions MVP (CRM)
  • I'm keen in MS technologies, SharePoint, Office 365 and development for them
  • Daniel is a Business Productivity Consultant & Microsoft Business Solutions MVP who is very enthusiastic about all things Office 365, Microsoft Flow, PowerApps, Azure & SharePoint (Online). Since the preview, Daniel has been working with Microsoft Flow and later on with Microsoft PowerApps. That led to him being awarded an MVP Award for Business Solutions. He loves to blog, present and evangelize about improving productivity in the modern workspace with these amazing tools!
  • Michelle is an Office 365 solution architect in Twin Cities, MN. She has been delivering business collaboration solutions for years with her focus on SharePoint and Office 365. Michelle is a recent board member of the Minnesota Office 365 User Group and has been a member of the SharePoint community since 2009. She is a frequent speaker at MNSPUG and SharePoint Saturday and co-chaired the Legal SharePoint User Group for 4 years. Her most frequent projects have involved rolling out a large deployment of Office 365, SharePoint Online intranet, build of a "CHAMPS" Office 365 user adoption program and most recently, SharePoint On-Premise to Online Migration. Michelle is very excited about cloud technology as it is shifting her IT Pro focus to collaboration strategy and technical adoption.
  • I'm a Microsoft Office Servers and Services MVP with a special interest in SharePoint, Office 365, Microsoft Flow, Microsoft Teams and PowerApps. I work at Triad Group Plc ( https://triad.co.uk)
  • Passionate #Programmer #SharePoint #SPFx #Office365 #MSFlow | C-sharpCorner MVP | SharePoint StackOverflow, Github, PnP contributor