Delete web part on page

How to delete a web part on a SharePoint Online page in a Power Automate flow.

URI

_api/v2.0/sites('@{variables('SiteId')}')/pages/@{variables('SitePageId')}/oneDrive.page/webParts/@{variables('WebPartId')}

Headers

{
"Content-Type": "application/json"
}

Body

Not applicable

Screenshot with example

Sample data
SiteId – contoso.sharepoint.com,0b11c57d-ef88-46d7-9743-8e800c507595,af1a15c6-956b-4652-b8f8-869836e4e6ee
SitePageId – 00c28b62-8518-411a-9149-05b8ab17936b
WebPartId – 070c2c53-7c23-4c44-a02b-34c1a61df2a8

deletewebpartonpage_blog

Expected response

HTTP statusCode 204

{
"statusCode":204,
"headers": {}
}

Copy/paste example

{"id":"e08c6119-ee29-492a-8a8d-29495db5a95e","brandColor":"#036C70","connectionReferences":{"shared_sharepointonline":{"connection":{"id":"/exp_sharedsharepointonline_e5efa"}}},"connectorDisplayName":"SharePoint","icon":"https://conn-afd-prod-endpoint-bmc9bqahasf3grgk.b01.azurefd.net/releases/v1.0.1723/1.0.1723.3986/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":"DELETE","parameters/uri":"_api/v2.0/sites('@{variables('SiteId')}')/pages/@{variables('SitePageId')}/oneDrive.page/webParts/@{variables('WebPartId')}","parameters/headers":{"Content-Type":"application/json"}},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{"Initialize_variable_-_WebPartId":["Succeeded"]},"metadata":{"operationMetadataId":"62570706-d419-4972-9305-ed7b941be51b"}}}

Resources

Delete webPart

That’s it, Happy testing!

You may also like...

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.