Hi Huys,
I'm currently building two flows linked to a PowerApp that manages Sharepoint Groups memberships on a single site collection.
So i've got one flow to add users to sharepoint groups, it works fine.
I also have one other flow that deletes users from SharePoint and it's driving me crazy.
I made a copy paste of the action to add user to the group and modified the URI section to add "RemoveByLoginName"
And it's not working, i have this error :
The parameter 'LoginName' in the request payload is not a valid parameter for the function import 'RemoveByLoginName'
So i tried to put the "Body" (Corps) section directly in the URI section
_api/web/sitegroups('355')/users/RemoveByLoginName("i:0#.f|membership|y.******@******.com")
Not working either and it's giving me this error
"The expression \"web/sitegroups('355')/users/RemoveByLoginName(\"i:0\" is not valid.
So i made another shot and tried to just put the UPN like that
_api/web/sitegroups('355')/users/RemoveByLoginName('y.******@******.com')
And nope, doesn't work, i have this error
The user does not exist or is not unique.
Anyone has a clue about what's wrong ?
Thanks,
Regards,
The solution is to url-encode the claim (the whole string starting with 'i:0#.f|...').
instead of
_api/web/sitegroups('355')/users/RemoveByLoginName("i:0#.f|membership|y.******@******.com")
you need to put the claim inside a encodeUriComponent() expression, so that it looks like this:
Hi @kokoloco , can u help me?
Im trying to remove some user from a SharepointGroup (Visitors, Id 70).
I tried follow your steps, but.. i cant know:
What is: xGroupPermiss...?
What is: xUserID?
When i add some user, i used this uri:
/_api/web/sitegroups/GetById(70)
As you can see, i didnt put nothing after sitegroups, but you did. What is this xGroupPermiss, the Id of the group or of the site? If is the site, where should i write the if of the group.
And about the xUserID is just the email : "daniel@aa.com" or should i write another thinks?
I tryed this, but didnt works:
Could you post a screenshot of your final REST settings that worked? Thanks!
Can you please help me in writing the REST API to get the sharepoint user id ? Because I am facing similar issue. I am trying to delete a user from sharepoint group. When I use RemoveById I am getting the error:cannot convert a primitive value to the expected type 'edm.int32'.
Ok nevermind,
Finally i'm using REST to get the SharePoint ID of the user using his UPN / email, and i've replaced the RemoveByLoginName by RemoveByID and it's working as expected.
Michael E. Gernaey
497
Super User 2025 Season 1
David_MA
436
Super User 2025 Season 1
Riyaz_riz11
244
Super User 2025 Season 1