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

Community site session details

Session Id :
Power Automate - Using Flows
Unanswered

Compare Emails and Remove User from 365 Group

(0) ShareShare
ReportReport
Posted on by
Hi all,

I have a flow that I want to remove users from a group if they don't exist in an excel file.

Currently I have:

List Rows (Excel) - Actual Name - Select Excel Rows
List Group Members (for the 365 group) - Actual Name - Select Group Members

I then select the emails from both of these. I have compose set up to view the outputs and I can confirm they both output exactly like the below:
[
  {
    "Email": "user123@mydomain.com"
  },
  {
    "Email": "user456@mydomain.com"
  }
]
I then have a filter array. I need this array to compare the group and the excel to leave me with just emails to use so I can remove them from the group.

So if user123@mydomain.com is in the group but not in the excel, this will then go to an apply to each to be removed from the group.

I have tried SO many things now and for the life of me I can't get this filter array to work correctly.

As far as I am aware, the below should work:

@not(contains(outputs('Select_Excel_Rows'), item()?['Email']))

But this won't let me add it as an expression. Whenever I get it 'working' it just doesn't have an output so removes all of the users.

Any help would be greatly appreciated!

TIA

 
I have the same question (0)
  • David_MA Profile Picture
    12,908 Super User 2025 Season 2 on at
    Compare Emails and Remove User from 365 Group
    Is this a one-time maintenance thing or are you trying to develop something where if someone is added to the group and they're not in the Excel spreadsheet, then you want to remove them? If it is a one-time thing, set it up like this and replace the compose action with the action to delete the person from the group:


    Some Notes:
    • The Excel action contains a query filter based on the e-mail address from the group matching an e-mail address in the spreadsheet:

    • The condition checks to see if one row was returned from the spreadsheet:

    • This is the expression used above: length(outputs('List_rows_present_in_a_table')?['body/value'])
     

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

Coming soon: forum hierarchy changes

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
Tomac Profile Picture

Tomac 544 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 482 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 287

Last 30 days Overall leaderboard

Featured topics

Restore a deleted flow