0

I am posting this information in case anyone else is trying to build a process like this.

I was trying to manage the users of my site collections and make sure that only active accounts have access. I have a Flow in Power Automate that is able to pull a list of users from the site collection _api/web/siteusers?$filter=PrincipalType%20eq%201%20and%20UserPrincipalName%20ne%20null&$Select=id,Title,Email,UserPrincipalName and then searches for them using the O365 Action by UPN. When this action fails, I know that the user is no longer an active user and they should be removed from the site collection. I then log the information of that user into an array for reporting. After that I send an HTTP action to SharePoint to remove that user from the site collection. The URI for this action or endpoint is _api/web/siteusers/removebyid('###'). An approval process could be added to this to make sure that users are not accidently deleted.

Hopefully this helps anyone else like it helped me!

1

Using the URI or endpoint of _api/web/siteusers/removebyid('###') was the final piece that I was missing and was causing most of my frustration. Hopefully others find this useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.