cancel
Showing results for 
Search instead for 
Did you mean: 
anton-khrit

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

About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/