web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Remove member from a S...
Power Automate
Unanswered

Remove member from a SharePoint group

(0) ShareShare
ReportReport
Posted on by 6
Hi,
I´ve created a flow removing members from a SharePoint group. However, sometimes the flow fails when the resource with the specified user ID does not exist. How can I fix this error? How to do a condition checking if the user is a member of the SharePoint group before removing?
 
Categories:
I have the same question (0)
  • Ninjasabi Profile Picture
    122 on at

    If the user is using the "Remove member from group" connector, here's how to simplify the flow to avoid errors when the user is not a member of the group:


    Step-by-Step Solution

    1. Add the "Remove Member from Group" Action

    • Use the "Remove member from group" action to remove the user.
    • Input the SharePoint Group and the User's ID or Email Address.

    2. Add a Simple Condition

    Since the action fails if the user is not a member of the group, you can handle this with a Condition or a Run After configuration.


    Option 1: Use a Condition to Check Membership

    • Before removing the user, check if they are a member of the group.

    • Use the "Get group members" action:

      1. Input the SharePoint group ID.
      2. The action will return a list of all members in the group.
    • Condition Configuration:

      1. Add a Condition action after retrieving the group members.
      2. Check if the user is in the list:
        • Expression:
          contains(body('Get_group_members')?['value'], 'UserID or EmailAddress')
      3. If Yes: Proceed to the "Remove member from group" action.
      4. If No: Skip the removal.

    Option 2: Use "Run After" to Handle Errors

    • Add the "Remove member from group" action directly.
    • Configure a fallback step (e.g., "Compose" or "Log").
    • Set "Run After" on the fallback step to handle cases where the action fails:
      • Click the ellipsis (...) on the fallback action and select "Configure run after."
      • Enable "has failed" and "has timed out."

    Example Flow Outline:

    1. Trigger: Manually trigger the flow or another appropriate trigger.
    2. Get group members: Retrieve the current members of the SharePoint group.
    3. Condition: Check if the user exists in the group:
      • Yes: Use the "Remove member from group" action.
      • No: Skip or log that the user is not a member.
    4. Log Result: Log success or failure for transparency.

    Why This Works

    • Option 1: Prevents the error by checking membership before removal.
    • Option 2: Gracefully handles errors without adding complex conditions.

    Let me know if you need help with setting up the expressions or additional details! 😊

  • SD-11121126-0 Profile Picture
    6 on at
    @Ninjasabi, thanks for your suggested answer! 
    Is option 1 an efficient solution with over 1000 SharePoint members? How should I setup the expressions on the Condition?
     
    Option 2, not sure how to set this up?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard