31 Jan’19

D365 GeneralCreate Folder Strucutre in SharePoint using MS Flows


In this blog we will see how we can create folder structure in SharePoint for Leads when the record is created in CRM using MS Flows

Pre Requisites:

SharePoint Integration must be enabled for the required entities


Step 1: Here in our Flows we have used “Create of a record(Leads)” as trigger condition.

Trigger Condition Lead creation

Step 2: Then we create the folder structure in SharePoint using the “Create File” action
Here we will create a text file which can be deleted later if not required.
Folder Path: /Lead/Topic_toUpper(replace(triggerBody()?[‘leadid’],’-‘,”))
Here “Topic” is Dynamics value and for the record ID copy paste the expression written above in the Expressions tab and add it at the end of the Folder Path.

Create main folder

After we have created the folder structure if the file is not required we can delete the text file by adding the delete step as shown below
Delete File

Step 3: We will also store the Folder ID in a variable “FolderId” to use in the later steps
FolderID variable

Step 4: Now we will create the same folder structure in CRM (Document Location)
Create Document Location 1

Document Location 2

Here for the parent site or Location we have we have added the GUID of the Parent Document Location site for Leads.
We can get this from the URL of the Parent Document Location record from Advanced Find (Document Location Entity)
Document Location Default Site

Lead document location record URL: https://org.crm8.dynamics.com/main.aspx?etc=9508&extraqs=%3f_gridType%3d9508%26etc%3d9508%26id%3d%257b1957C431-5F15-E911-A96F-000D3AF29269%257d%26rskey%3d%257bF5B008AC-07D9-4554-8509-2C05767BFF51%257d&histKey=17520860&newWindow=true&pagetype=entityrecord&rskey=%7bF5B008AC-07D9-4554-8509-2C05767BFF51%7d#371473802

Step 5:  Similarly we can also create sub folders within the main folder as per the requirements

Hope this Helped!

Written by

Clinton D'Mello

Software Engineer

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Import Time Entries in PSA from your Bookings in D365 PSA v3

    25 April’ 2019

    Often, one of the real-life scenarios is making time entries by either remembering what you did the whole week or lookin...

    Read more
  • Managing with Multiple Legal Entity Data in Microsoft Dynamics NAV / Business Central

    25 April’ 2019

    Problem Statement: Well, my client is a Trader of Oils & Fatty Acids and has multiple legal entities to perform vari...

    Read more
  • Facing issues with Microsoft Outlook? Use Microsoft Support & Recovery Assistant

    22 April’ 2019

    Many times you find issues like one of your users are unable to set up their Office 365 Email account in Microsoft Outlo...

    Read more
  • How to insert data into reports in Business Central using a variable in Request Page

    16 April’ 2019

    Introduction: Here, I will demonstrate how a user can add data into reports by themselves from the Request Page in Busin...

    Read more
  • Non-Billable classification of task work around in PSA V3

    15 April’ 2019

    Problem Definition: As soon I upgraded my PSA version from V2 to V3, I saw that the role field got deprecated. Not only ...

    Read more
  • We respect your privacy.
  • This field is for validation purposes and should be left unchanged.