Instructions for creating a Power Automate workflow to Create SharePoint Lists From a Power Apps Collection
- Create a new flow
- Use the When Power Apps calls a flow (V2) trigger
- Create two text parameters.
- One for the collection of lists to create
- One for the root URL of the SharePoint site you want to create.
- Add a Parse JSON step
- In the content place the lists to create parameter name you created in the trigger
- In the Schema, paste the following directly into the Schema window (not using the sample payload link)
{
"type": "array",
"items": {
"type": "object",
"properties": {
"BaseTemplate": {
"type": "integer"
},
"Title": {
"type": "string"
}
},
"required": [
"BaseTemplate",
"Title"
]
}
}
- Add an Apply to Each step
- In the parameters for the Apply to each add the outputs from the Parse JSON step.
- Inside the Apply to each step add a step to send an http request to SharePoint
- In the site address add the root URL parameter you created in the trigger.
- In the Method put POST
- In the Uri put _api/web/lists
- Select both of the advanced parameters from the drop down
- In the Headers add Accept in the left had box and application/json;odata=verbose in the right one
- In the second row put Content-Type in the left box and application/json;odata=verbose in the right one
- In the Body put
{ '__metadata': { 'type': 'SP.List' }, 'AllowContentTypes': true,
'BaseTemplate': @{item()['BaseTemplate']}, 'ContentTypesEnabled': true, 'Title': '@{item()['Title']}' }
NOTE: In the Body @{item()['BaseTemplate'] is the BaseTemplate field and the @{item()['Title'] is the Title field from the Parse JSON step.