cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
stormin_30
Helper I
Helper I

SharePoint remove user

Hello All,

 

I am trying to add and remove users to a SharePoint site using the "Send an HTTP request to SharePoint" action. The add action works but the removal does not.

 

Any ideas where I am going wrong?

stormin_30_0-1602972537420.pngstormin_30_1-1602972578698.png

Error message: The expression "web/SiteGroups(https:/normyoung.sharepoint.com/sites/SharePointDemo/_api/Web/SiteGroups/GetById(5))/users/removeByLoginName" is not valid.
clientRequestId: b2bf9405-1b0c-438e-80a5-c8d575776e18
serviceRequestId: a5ac849f-b04d-b000-cc44-463d26a3000d

Thanks.

 

Norm

 

1 ACCEPTED SOLUTION

Accepted Solutions
stormin_30
Helper I
Helper I

Solution:

 

Get user ID

stormin_30_0-1603022558560.png

 

Compose user ID

stormin_30_1-1603022651221.png

@{body('Send_an_HTTP_request_to_SharePoint_-_Get_User_Id')['d']['id']}

 

Remove user

stormin_30_2-1603022680013.png

 

 

View solution in original post

3 REPLIES 3
ChrisPiasecki
Super User
Super User

Hi @stormin_30,

Try adding the user login into the request string as such. 

..../removeByLoginName(@v)?@v='<USER CLAIMS>'  

https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-rest-reference/dn5314...

---

Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

Hi @ChrisPiasecki, thank you for the suggestion, I appreciate it. I was not able to get "removeByLoginName" to work and went with "removeById".

 

It's working now and I will post the solution to help others.

 

Norm

stormin_30
Helper I
Helper I

Solution:

 

Get user ID

stormin_30_0-1603022558560.png

 

Compose user ID

stormin_30_1-1603022651221.png

@{body('Send_an_HTTP_request_to_SharePoint_-_Get_User_Id')['d']['id']}

 

Remove user

stormin_30_2-1603022680013.png

 

 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,349)