Using Power Automate (Flow) to Create Sub-Folders in SharePoint

Posted on: October 7, 2020 | By: Sarah Han | Microsoft Dynamics CRM

The native SharePoint Online integration is a great feature in D365 Customer Engagement (CRM). It allows users to do a variety of things, including:

  • Create, Upload, and View Documents in SharePoint from within the customer engagement apps.
  • Take advantage of SharePoint document abilities such as checking documents in and out.
  • Provide an organized method for locating documents with the app; a better approach than just creating attachments to a note
  • Remove the storage burden – SharePoint storage is 1/10th the cost of CE storage, and documents consume large amounts of storage space.

With the native integration activated, the app will create a link within the configured entity under the files tab the first time it is opened and provide controls to access the documents.

Here is a video on creating this integration: Connect to SharePoint Online

A common request is creating a Sub-Folder structure within each of the SharePoint files created by the integration to help keep documents organized.

The latest version of Power Automate makes this a very easy and straightforward process. In this blog post, we’ll be showing you how you can use Power Automate (Flow) to create sub-folders in SharePoint.

The Process

We have the integration creating a Document location in SharePoint for the Account entity in CRM. When the file tab opens the first time, it creates a related folder in the SharePoint library associated with the CRM account. CRM stores this location internally under Document Locations entity. Additional entities can be activated during set-up of the SharePoint integration. A different sub-folder structure could be created for each using the method described below.

We want the following sub-folders to be created automatically created each time a new Account folder is created: Proposals, Change Orders, Statement of Work (SOW) .

1. Create the Flow

From the Power Automate Screen, select New, the choose Instant-From Blank.

Select a Common Data Service connector – When a record is created, updated or deleted.

Set the trigger condition – Choose Create.

Select the trigger entity – Choose Document Locations from the drop down. This is very important. Creation of a new document location in CRM will trigger this flow to run. This occurs when a file tab on the Account is opened for the first time in CRM.

Set the Scope to Organization.


2. Create the SharePoint Actions.

Click on New Step and add a SharePoint Connector for Create New Folder.

Fill in the Site address of your SharePoint library from the Integration set-up and give the step a name by clicking on the three dots on the right side.

Choose the List or Library- Select Account from the drop down

Set the folder Path. This is the key step for this whole process. When you click on the Folder Path field, it will provide a list of dynamics choices to select from.

Look for Relative URL, then add /Proposal (the first subfolder name we want to create):

The completed step for the first folder Proposals should look like this:

To create the additional folders, simply click on the three dots on the side, select Copy to My Clipboard, then click on New step under the SharePoint step that was just created and select My Clipboard. Change the folder path on this new step to SOW, rename the step, and save. Repeat this process for each other folder that needs to be created.

The completed steps will look like this:


The first time the Files tab is opened on the account form, the SharePoint Integration in CRM fires to create the Document location.

Within a few seconds after the document location is created the first time, the Power Automate process fires on creation of the Document Location to build the sub-folder structure (You may need to hit refresh to see them):

Next Steps

Replace your old ways of doing business with a modern, secure, and customizable system that already works with the Microsoft Office tools that your team is familiar with – Teams, Outlook, Excel & Word. Choose Microsoft Dynamics 365 for managing Sales and Customer Service interactions, and Marketing Outreach programs.

Logan Consulting, your Chicago-based consulting firm, has helped clients across the nation find their full potential every day. Stop losing revenue opportunities and start managing your company efficiently. Talk to us and watch your digital transformation begin.


How to Double your ROI with Cloud Solutions
How to Double your ROI with Cloud Solutions

Free Download:

How to Double your ROI with Cloud Solutions

Download the guide ›

Top 10 Inventory & Operations Decisions Distributors Are Making Blind
Top 10 Inventory & Operations Decisions Distributors Are Making Blind

Free Download:

Top 10 Inventory & Operations Decisions Distributors Are Making Blind

Download the guide ›

2020 Nucleus Research Report on ERP Technology

Free Download:

2020 Nucleus Research Report on ERP Technology

Download the guide ›