Forum Discussion
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:
- Ankit JetaniCopper 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 😞
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
Documentation: Set-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 JetaniCopper Contributor
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!