In parts 1 and 2 we built a flow that broke inheritance on a list item and then gave a person contribute permission. Both of these functions are useful and we might want to use them again. Rather than rebuilding the REST api strings every time we need them, this post will look at how to split out the two permission actions into reusable flows that can be called from any flow.
Flow Split Details
So the parts of flow we are going to split are the two steps for the break inheritance and 5 last actions that give contribute permission.
We are going to start by looking at the Break Item Inheritance.
- Create a blank flow and add the trigger Request – When a HTTP request is received.The HTTP request needs a JSON Schema to know what information it will receive when called. In order to build the URI-String it will need the ListName and ItemID and in order to make the HTTP Request it will need the Site Address.
The schema can be generated using sample data. The values don’t matter but the value types do matter. So here is an example:
{"SiteAddr":"value","ListName":"value","ItemID":1}
- Inside the When a HTTP request is received, click on Use sample payload to generate schema and paste in the above example and click Done.
Quick Hint – Add the sample data in as a comment to the HTTP action, it will help later on. - Build the Initialise Variable for the URI-String and the HTTP call the same as you had them in the previous flow, using values from the trigger event.
- Save your flow and copy the HTTP Post URL from the trigger action.
- After the Initialise Variable – ListName action, insert an action HTTP – HTTP action. The method is POST and paste in the URI copied in the previous step.
In the HTTP – HTTP, the headers remain blank and the body needs to contain a JSON statement based of the example earlier, filled in with the variables and ID.
- Remove the 2 steps that this replaces, see the diagram above, and save. Test to make sure your flow still works.
NOTE if the called flow fails it will not report back so you will need to check that the separate flows have succeeded. In a future post we will look at returning meaningful information.
Final Flows
Rather than make this post excessively long and repeat the above steps for the giving contribute permission section, I will put links below to pictures of the final flows.
“How to manage permissions on a SharePoint List Item using Microsoft Flow! – Series Navigator: