Create Page Template
How to promote an existing page as a (draft) template on a SharePoint Online site using a Power Automate flow.
URI
_api/sitepages/pages(@{variables('ID')})/SavePageAsTemplate |
Headers
{ | |
"Accept": "application/json;odata=verbose", | |
"Content-Type": "application/json;odata=verbose" | |
} |
Body
Not applicable
Screenshot with example
Sample data
ID – 216
Copy/paste example
{"id":"016da8ea-c80e-40da-8dfd-4468b95904ae","brandColor":"#036C70","connectionReferences":{"shared_sharepointonline":{"connection":{"id":"/exp_sharedsharepointonline_e5efa"}}},"connectorDisplayName":"SharePoint","icon":"https://connectoricons-prod.azureedge.net/u/laborbol/partial-builds/ase-v3/1.0.1653.3402/sharepointonline/icon.png","isTrigger":false,"operationName":"Send_an_HTTP_request_to_SharePoint","operationDefinition":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_sharepointonline","operationId":"HttpRequest","apiId":"/providers/Microsoft.PowerApps/apis/shared_sharepointonline"},"parameters":{"dataset":"@parameters('SPOSiteCollection_PowerUsers (exp_SPOSiteCollection_PowerUsers)')","parameters/method":"POST","parameters/uri":"_api/sitepages/pages(@{variables('ID')})/SavePageAsTemplate","parameters/headers":{"Accept":"application/json;odata=verbose","Content-Type":"application/json;odata=verbose"}},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{"Initialize_variable_-_ID":["Succeeded"]}}} |
Resources
That’s it, Happy testing!
Awesome blog Dennis and very useful, I appreciate the great content!
I’m trying to follow this one and struggling to get the page ID’s from ‘Sites Pages’ , could you expand please?
My approach (I’m putting a provisioning flow together), is to copy the templates folder in our root site, to ‘SitesPages/Temp’, I then aim to use your method to save as a template and then publish, followed by deleting the temp folder.