Grant access to folder in SharePoint for Access Team members with Flow

Posted by

There was a question on the Dynamics CRM community forum how to add folders to a document location in SharePoint and grant access to that folder for the members of the Access Team on a record in Dynamics 365 CE. This turned out to be much easier than I first thought, especially with the new actions of the SharePoint connector in Flow.

Here is the overview of the Flow:

To start the Flow I will use the trigger When a (Opportunity) record is selected. Then I list the related Document Location record to get the value of the Relative URL field, that is set in the compose action: first(body(‘List_Document_Location_record’)?[‘value’])?[‘relativeurl’]
Next action is to create the folder in the target library with the path: relativerurl/shared

Next part of the Flow is to get the Access Team regarding the selected Opportunity. The teamid is set in the compose field: first(body(‘List_Team_record’)?[‘value’])?[‘teamid’] and used to list the members of this Access Team. Enter the Entity Name as a custom value: teammemberships

For each Team member I get the User record: items(‘Apply_to_each’)?[‘systemuserid’] and use the Primary Email address to grant access to the folder id that was created.

Now when I run the Flow from the Opportunity, as a result a folder is created and shared with the two specific users of the Access Team.

In this way a more sophisticated integration of Dynamics 365 CE and SharePoint becomes easier to realize.

Leave a Reply

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