0

I have user power automate to return the sharepoint Site owners using API call as "_api/web/associatedownergroup/users". I got the desired result of SharePoint site owners but in that list it also includes Owners who have left the organization. How can I remove those names from the list so that i will get result of only active owners of that sharePoint site?

3
  • Can you elaborate more on "left the organization"? does it mean those users are Inactive users (blocked sign-in) or those users are deleted? Commented Jun 20, 2023 at 8:08
  • Users deleted!! Commented Jun 20, 2023 at 9:00
  • So do you want it as one time process like from all the sites, deleted users from tenant should be removed from Owner groups all well? or you want to check every time in your Power Automate whenever you get users using API? Commented Jun 20, 2023 at 10:45

1 Answer 1

0

Very often you don't delete users from Active Directory, you just disable them.

Get user profile (V2) action will return you this information under "Account enabled?" property. In expression it looks like this for example ( outputs('Get_user_profile_(V2)')?['body/accountEnabled'] ).

You will need to loop with Apply to each action through the list of the owners and use that Get user profile (V2) action inside:

  1. to check the status of the account enabled/disabled.
  2. In case the action will throw you an error that user has not been found, it will tell you that the user does not exists anymore

Based on this you will know which user is active or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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