Skip to main content

Notifications

Community site session details

Community site session details

Session Id : LaIYPF7GEGcpw59cigJgxp
Power Automate - Building Flows
Unanswered

how to remove webpart/s from sharepoint site using power automate

Like (2) ShareShare
ReportReport
Posted on 20 Feb 2025 12:58:07 by 165

I have tried multiple ways to remove particular webparts in a site collection thats on the home.aspx page but keep getting resource not found.

I have passed the following uri

https://xxx.sharepoint.com/sites/24458/_api/web/getfilebyserverrelativeurl('/sites/24458/SitePages/Home.aspx')/getLimitedWebPartManager(scope=1)/webparts('webpartIdGuid')

Also tried

_api/web/getfilebyserverrelativeurl('/sites/24458/SitePages/Home.aspx')/getLimitedWebPartManager/webparts/getbyid('webpartIdGuid')
 
I used webpart GUID from the data-sp-web-part-id on the page (via view source)
 

Using the Send an HTTP request to SharePoint 

Site Address : Site Collection Url 

Method:Post 

Headers

{
  "Accept": "application/json;odata=verbose",
  "X-HTTP-Method": "DELETE",
  "IF-MATCH": "*"
}

I'm not sure what am missing. Any help would be appreciated

  • Expiscornovus Profile Picture
    31,686 Most Valuable Professional on 04 Mar 2025 at 09:52:40
    how to remove webpart/s from sharepoint site using power automate
    No problem. For the Delete node you can use the DELETE method in combination with the GetNodeById method.
     
    Try something like the below (test it properly first, because this is a delete action).
     
     
     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, Bluesky profile or Youtube Channel
  • naijacoder Profile Picture
    165 on 04 Mar 2025 at 03:11:42
    how to remove webpart/s from sharepoint site using power automate
    Thanks so much Dennis for your time.
    I actually came across your blog below earlier. This was very useful s its really hard to find good docs from MS
     
    and i have been able to put thngs together for the Image Galley and Image webpart.
     
    Also one more question and please let me know if this is even possible.
    I have some links in the quicklaunch in a sharepoint site that i would like to remove.
    I can easily receive the navigation quicklaunch including the node id but can get to remove them using the below api via power automate

    To get all quicklaunch
    /_api/Web/Navigation/QuickLaunch?$select=Id,Title

    To remove I tried the 2 below (Not sure if its the right rest api)
    /_api/Web/Navigation/QuickLaunch/removelink/2030 or /_api/web/Navigation/DeleteNodeId(2030)

    There is nothing here
    https://learn.microsoft.com/en-us/previous-versions/office/sharepoint-csom/jj171813(v=office.15)
  • Expiscornovus Profile Picture
    31,686 Most Valuable Professional on 01 Mar 2025 at 14:27:37
    how to remove webpart/s from sharepoint site using power automate
    Quick Links and Image Gallery are supported by the Graph API. Video I would need to double check, you might be able to use the Document Embed for that as well
     
    Additionally, I have written a blog about the Quick Links a couple of days ago:
     
    I will probably also create blogs for the Image Gallery and the Document Embed in the next few days as well 😁

     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, Bluesky profile or Youtube Channel
     
     
  • naijacoder Profile Picture
    165 on 27 Feb 2025 at 22:19:08
    how to remove webpart/s from sharepoint site using power automate
    Thanks Expiscornovus
    I would like to a quicklink , image galleryor Stream webparts
    Is this possible with the  Send an HTTP request to SharePoint action?
    If you have any resources or links pls share

    Thanks
  • Expiscornovus Profile Picture
    31,686 Most Valuable Professional on 27 Feb 2025 at 09:29:02
    how to remove webpart/s from sharepoint site using power automate
    Hi,
     
    You can add a web part with SharePoint REST API or the Graph API. Both can be used in a Send an HTTP request to SharePoint action.
     
    However, the Graph API doesn't support all type of web parts yet. What kind of new web part do you want to add?
     
     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, Bluesky profile or Youtube Channel
  • naijacoder Profile Picture
    165 on 27 Feb 2025 at 04:34:00
    how to remove webpart/s from sharepoint site using power automate
    Thanks for you response Expiscornovus
    I finally got it working using Send an HTTP request to SharePoint.
    My question to you is what api can i use to ad a new webpart with data?
    Can the Send an HTTP request to SharePoint do this or i have to use graph?

    Thanks in advance
  • Expiscornovus Profile Picture
    31,686 Most Valuable Professional on 24 Feb 2025 at 09:54:10
    how to remove webpart/s from sharepoint site using power automate
     
    I see in your screenshot you used GET method in the Graph Explorer. Try and Select the DELETE method (see the screenshot below).
     
    Just a heads-up, the format of the Url would be different in the Graph Explorer compare to the Send an HTTP request to SharePoint action. I adjusted my example to be used in that specific action.
     
    For the Graph Explorer application you can just follow the docs examples.
     
     
     
     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, Bluesky profile or Youtube Channel
     
  • naijacoder Profile Picture
    165 on 23 Feb 2025 at 23:12:45
    how to remove webpart/s from sharepoint site using power automate
    Oops i got I forgot to select DELETE instead of GET :)
     
    Hi there,
    I decided to give a try using MS Graph explorer and this is the test webpart i want to remove
    See below and i have given the right consent but it isn't doing any thing.
    What should i be adding in my header. I feel i'm missing something .
    Thanks
  • Expiscornovus Profile Picture
    31,686 Most Valuable Professional on 21 Feb 2025 at 09:07:44
    how to remove webpart/s from sharepoint site using power automate
     
    Those would be the Graph API object ids, those are different. Apologies for being unclear about that. Do you know how to collect those?
     
    Below are the ids from my example to give you an idea of the format of those values, if that helps?
     
     

    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, Bluesky profile or Youtube Channel
  • naijacoder Profile Picture
    165 on 21 Feb 2025 at 06:20:28
    how to remove webpart/s from sharepoint site using power automate
    Thanks for you response
    using the uri below
    _api/v2.0/sites('46f7d5ae-0c5e-4711-9910-8898e141c29b')/pages/'11'/oneDrive.page/webParts/c4bd7b2f-7b6e-4599-8485-16504575f590
     
    I get error
    Unexpected response from the service
    clientRequestId: 024e186b-2f5a-404a-8a67-5f00fcd39ae0
    serviceRequestId: 339583a1-3083-4000-c335-9128b0fc42c4

    Is there anything i'm doing wrong perhaps?
     
     
    Is the data-sp-web-part-id the correct id for the webpart and is the pageid a guid or a whole number?
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 101

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 82 Super User 2025 Season 1

#3
David_MA Profile Picture

David_MA 48 Super User 2025 Season 1

Overall leaderboard
Loading started