Hi all,
I've successfully set up my flow to add users to a SharePoint group using the instructions from this post:
https://powerusers.microsoft.com/t5/Building-Flows/Adding-users-to-a-SharePoint-Group/td-p/309811
To remove a user from a group, I'm not quite following this solution:
I'm looking at Microsoft's documentation:
Here's a screenshot of my flow. It's grabbing the user information in the previous step of Get User Profile, but it's falling down on the URI and body steps. Help would be appreciated. (I hate syntax.)
Solved! Go to Solution.
Hi @smorley,
I see in the screenshot you are using a principalname value. Like mentioned in my previous reply, the loginname value will be slightly different. That is why it can't find your user.
A quick fix could be to concatenate the userPrincipal name with 'i:0#.f|membership|':
This example assumes your action before it is a Get User Profile (V2) (which you haven't renamed 😁) and that the user you are using in this test is an internal user and not a guest user (part of the tenant).
concat('i:0#.f|membership|',outputs('Get_user_profile_(V2)')?['body/userPrincipalName'])
Hi @smorley,
This method expects the loginName. A loginName field in SharePoint Online typically has something like: i:0#.f|membership|janedoe@contoso.onmicrosoft.com which is not the UPN. You probably need to change that in your string variable.
The Send an HTTP request to SharePoint action also needs some changes. First of all you want to use a POST method. I would also change the Accept header value. In the body I would also use the loginName property.
Below is an example of that approach:
@Expiscornovus Definitely making some headway.
I've updated the action to reflect the changes you suggested.
The error message I get is:
{"odata.error":{"code":"-2130575276, Microsoft.SharePoint.SPException","message":{"lang":"en-US","value":"The user does not exist or is not unique."}}}
clientRequestId: 6ae24fea-75c3-4c7a-b7fd-d1478b8f2184
serviceRequestId: fa8725a0-5061-1000-61dd-bbc02083e781
The error is referring to the body statement:
Hi @smorley,
I see in the screenshot you are using a principalname value. Like mentioned in my previous reply, the loginname value will be slightly different. That is why it can't find your user.
A quick fix could be to concatenate the userPrincipal name with 'i:0#.f|membership|':
This example assumes your action before it is a Get User Profile (V2) (which you haven't renamed 😁) and that the user you are using in this test is an internal user and not a guest user (part of the tenant).
concat('i:0#.f|membership|',outputs('Get_user_profile_(V2)')?['body/userPrincipalName'])
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 |
---|---|
66 | |
22 | |
16 | |
16 | |
11 |
User | Count |
---|---|
133 | |
44 | |
32 | |
32 | |
28 |