Forum Discussion

Chip Cooper's avatar
Chip Cooper
Copper Contributor
Feb 12, 2020

Set AssociatedOwnerGroup for a web using REST

I am building sub-sites under a site collection via FLOW/Power Automate, and we need to know how to make the default owners group for the site.

We can build the SharePoint groups and assign users, but how do you set the property:
AssociatedOwnerGroup

Anyone have a sample POST?
https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-visio/jj245638(v=office.15)?redirectedfrom=MSDN

 

These 2 threads are not helpful and don't answer the question:

https://social.technet.microsoft.com/Forums/en-US/09288617-90d8-410a-88b2-30c3d77f0dc6/how-do-you-set-associatedownergroup-for-a-web-using-rest-api?forum=sharepointdevelopment

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/aa435402-ef15-4b6e-9b10-965861e93f50/how-to-set-associatedownergroup-with-rest-api-in-sharepoint-2013?forum=sharepointdevelopment

  • Ankit Jetani's avatar
    Ankit Jetani
    Copper Contributor

    Chip Cooper Did you ever get a solution for this? I'm also trying to achieve this in Power Automate but couldn't find any solution so far 😞

  • Chip Cooper Ankit Jetani 

     

    Not sure if it is possible using SharePoint REST API. However, you can easily do it using PnP PowerShell like: 

     

    Connect-PnPOnline -Url $sitetUrl
    Set-PnPGroup -Identity 'My Site Owners' -SetAssociatedGroup Owners

     

    DocumentationSet-PnPGroup 


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

    For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs

    • Ankit Jetani's avatar
      Ankit Jetani
      Copper Contributor

      ganeshsanap

      Yes, I'm aware that it's possible using PnP PowerShell but I'm specifically looking to do it in Power Automate using REST API as I'm trying to automate the entire process. And to use PnP PowerShell, we have to use either Azure Function or Azure Automation Runbook which unfortunately isn't an option for me.

       

      On this reference page for site-related resources and endpoints for the SharePoint REST API - https://learn.microsoft.com/en-us/previous-versions/office/developer/sharepoint-rest-reference/dn499819(v=office.15)

      it's mentioned that the AssociatedMemberGroup, AssociatedOwnerGroup and AssociatedVisitorGroup are available via REST API and are read/write properties (of the web) of type SP.Group. So I tried to update it with the 'Send an HTTP request to SharePoint' action with the below parameters and it runs successfully but it doesn't update the site owner group.

      And if I run it with GET method without the parameters, it successfully gives me the current owner group.

       

      So I'm trying to figure out the right parameters for the POST request but haven't been successful so far. Any help would be appreciated. Thanks in advance!

       

       

Resources