Sync Dynamics 365 entity with SharePoint Online

Published: Feb 13, 2019

Dynamics 365 is not a CRM product or an ERP, it is a cloud-based combination of CRM and ERP enterprise system built by Microsoft. Dynamics 365 is having entities and are used to manage the business data in Dynamics 365. 

SharePoint Online is a cloud-based services built by Microsoft, which helps organizations to share & manage their documents, internal sites and organization data from anywhere like from office/home/mobile by using SharePoint development tools.

Many organizations use the Dynamic 365 and SharePoint Online to manage their data. Some of them have requirements to copy data from Dynamic 365 to SharePoint online or vice versa. Microsoft has provided one App – Microsoft Flow aka MS Flow which allows users to create and automate workflows and tasks across the applications. Microsoft is providing many of the ready to use templates for the same. It has some sort of events which can be triggered in the background for events such as – create, update or delete items etc. across multiple applications.

Using this software, we can synchronize the Dynamics 365 data/record/activity with SharePoint Online. In short, using the MS Flow, we can automate/repetitive process in the background. MS Flow also provides many default templates like create/update/delete item in SharePoint/Dynamics 365, so the user can use them very easily. Also, the user can use/call the custom API services in MS Flow for certain business process.

MS Flow


To use Dynamics 365, SharePoint Online and MS Flow, we require an Office 365 license with these services enabled on it. Let’s create one MS Flow to copy data from Dynamic 365 to SharePoint Online site using MS Flow.

Create MS Flow to add folder in SharePoint document library when new item is created in Contacts under Dynamic 365

The case would be like if the user creates new item in entity (e.g., contacts) in the Dynamics 365, it will automatically create a folder using “Full Name” attribute of that dynamics 365 contact entities in the SharePoint Document library.

Here are the steps to achieve this:

  • Open the Flow URL:
  • Click on My Flows from the left menu.

    My Flows

  • Click on New > Create from the blank.

    Create from the blank

  • Click on “Create from blank” button.

    Create from blank

  • It will open the New Microsoft Flow screen.

    Microsoft Flow screen

  • Update the Title of Microsoft Flow from the top-left corner in the Microsoft Flow screen, as shown in below screenshot.

    Update the Title

  • Now, search the “dynamics” keyword in the searchbox and click on the “Dynamics 365” from the results.

    Dynamics 365

  • It will show all the triggers/action related to the Dynamics 365. Select “When a record is created” from the Triggers tab.

    Triggers tab

  • Select a Dynamics 365 Organization Name from the dropdown.
  • It will populate the Entity name in the Entity Name dropdown, select the Entity name (e.g., Contacts) in which we want to add a trigger.

    Entity name

  • Now, click on the “New Step” button to add the SharePoint action once the record is created in the Dynamics 365.

    Add the SharePoint action

  • Now, search the “SharePoint” keyword in the searchbox and click on the “SharePoint” from the results.

    Search the SharePoint

  • It will show all the triggers/action related to the SharePoint. Search the “Send” keyword in the search box, it will show the “Send an HTTP request to SharePoint” action. Click on it.

    Show all the triggers

  • It will ask the below details:
  1. Site Address: Select the site where our document library is available. If your site is not available on the list, then click on the “Enter Custom value” option and enter your site URL manually.

    Site Address

  2. Method: Select the Method like GET, PUT, POST, PATCH or DELETE. In our case we need to create a Folder in the document library, so we will use the POST method.
  3. Uri: Enter the Resource Identifier URL like “_api/Web/GetFolderByServerRelativeUrl(‘Shared%20Documents’)/Folders”

    Note: Here we are a creating folder in the root directory of the default document library, so we have used “Shared%20Documents”. If user wants to create any other document library or any another folder then we need to change it accordingly.

  4. Headers: Now we need to below two headers in the header section for our POST method call.

    i.    Key: Content-Type, Value: application/json; odata=verbose

    ii.    Key: accept, Value: application/json; odata=verbose

    Note: Below is Text-mode header:

    {   “Content-Type”: “application/json; odata=verbose”,  

    “accept”: “application/json; odata=verbose”


    Switch to Test Mode

    Test Mode

  5. Body: Enter the Body like below:

    “{ ‘__metadata’: { ‘type’: ‘SP.Folder’ }, ‘ServerRelativeUrl’:’@{triggerBody()[‘fullname’]}’}”

    Note: here “@{triggerBody()[‘fullname’]}” is selected “Full Name” from the Dynamics Content showing in below screen shot. This is Dynamics 365 Contacts entity attribute, we can select another attribute if we required.

    Full name

    After all the configuration it will look like below:

    Finished configuration

  • Now, Microsoft Flow is ready, the full flow will look like as below:

    Microsoft Flow is ready

  • Click on the Save Button from the top-right corner.

    Click on the Save Button

  • Now, our Flow is ready to execute.
  • To test it Open the Contacts Entity in the Dynamics 365.

    Open the Contacts Entity

  • Click on the New Button.

    New Button

  • Enter the Details like Full Name, Job Title, etc. and click on “Save & Close” button.

    Enter the Details

  • Once the item created it will create a Folder in the SharePoint Document library based on the Full Name.

    SharePoint Document library


Here, we have created a folder in SharePoint Online document library with same contact name added in Dynamic 365 entity using MS Flow. Using this approach, without any custom solution, we can perform various operations across multiple tools and services. This automated process will be very useful to copy/sync data between various Office 365 apps e.g.:(Between Dynamic 365 to SharePoint Online) and from other tools.


  • Leave a message...

Related Articles

Power Apps – Portals (Part 3)

Sep 15, 2020

HIPAA Compliance Healthcare Software Development

Sep 9, 2020

Power Apps – Model Driven Apps (Part 2)

Sep 7, 2020