Hi,
I've got a flow that creates a security group on my site and that works fine when just setting the title of the group. What i cannot figure out is how to change the Group Owner for that security group (since it defaults to the owner of the flow).
I have an Http request that creates the group -
This works great.
If I add under title - "Owner":"username" or "Owner":"Another security group name" it throws an error 400 about primitiveValue nodes.
If I create the security group with just a title, parse json to get the proper id and then create a second Http request to update the owner - i still get errors about either cannot find resource or invalid request.
I have tried using URI _api/web/sitegroups(1085)/owner or _api/Web/SiteGroup/GetById(1090)
and the body as
{
"_metadata": (
"type":"SP.Group"
}
"SPGroup.Owner":"{'ID':'9'}"
}
Or
{
"_metadata": (
"type":"SP.Group"
}
"Owner":"{'ID':'9'}"
}
i also tried using the name of the security group i want as the owner. I've tried just putting in a single individual account name to see if i could do even that but no go.
I saw this thread - https://sharepoint.stackexchange.com/questions/198710/changing-the-owner-of-a-group-via-rest-api but the 1 answer it got made no sense to me as it just seemed to say what the OP already said.
I'm sure it's something i'm missing that maybe easy, but i'm stumped.
Does anyone know how you can change the group owner for a sharepoint group with Flow?
Thanks!
Solved! Go to Solution.
The SharePoint Connector for Flow has some limitations, so this is likely something you'll need to accomplish either via the SharePoint REST API, and/or via an Azure Function that utilizes the Owner property via the SP.Principal type.
The Group Properties API reference has the Owner property listed as having a No for the Returned with a resource flag. I'm not a SharePoint developer, but from my personal experience this means that you likely can't return anything from that property via an HTTP request.
For this reason, your best and easiest bet may be to create and call an Azure Function that runs a PowerShell script to change the group owner as desired. To get started, see the Create serverless logic with Azure Functions learning module.
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
The SharePoint Connector for Flow has some limitations, so this is likely something you'll need to accomplish either via the SharePoint REST API, and/or via an Azure Function that utilizes the Owner property via the SP.Principal type.
The Group Properties API reference has the Owner property listed as having a No for the Returned with a resource flag. I'm not a SharePoint developer, but from my personal experience this means that you likely can't return anything from that property via an HTTP request.
For this reason, your best and easiest bet may be to create and call an Azure Function that runs a PowerShell script to change the group owner as desired. To get started, see the Create serverless logic with Azure Functions learning module.
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
I have never worked with Azure functions - do you know of any site that might be a good start for me to test that route?
TL;DR can't be done with REST, but you can send some XML to a processQuery endpoint to get it done.
I had a long version of this typed out, but page timed out (wasn't logged in), and I lost it, so you'll have to make do with the short answer.
Almost all of the credit belongs with Chris Givens, I just tinkered with it a bit
My solution is built on a series of LogicApps called by a SharePoint Designer 2013 WF with HTTP requests to keep a proper trigger on 'Create new Item' rather than faking it with a series of polls every 3/5 minutes. My way is much cheaper 🙂
the bit you're missing goes like this:
XML to change owner to a Group
No errors this time
Success
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
72 | |
27 | |
22 | |
15 | |
13 |
User | Count |
---|---|
138 | |
43 | |
42 | |
35 | |
31 |