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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Search for Users- Gett...
Power Automate
Answered

Search for Users- Getting same user multiple times

(0) ShareShare
ReportReport
Posted on by 14
Hi!
 
I am trying to create a scheduled flow that auto adds employees to different tags based on their department that is listed in 0365.
 
My flow uses "Search for Users', then a condition that the department of the user is equal to a certain name,
 
Inside, I use 'List the members of a tag' to get the current list of users attached to said tag.
 
Then I have another condition that the Teams Display name for a tag member has to be equal to the display name from the department condition. If it is false, the user is added to the tag (currently just sending me a chat instead).
 
For some reason when I run this I get the same users ran through 3-4 times but then I have one user not included at all. Is there a way to stop this in the 'Search for Users' action? I want every user ran through only once.
 
I would also appreciate any tips on my flow if you see anything that could be better :-)
 
 
 
 
Categories:
I have the same question (0)
  • Verified answer
    Expiscornovus Profile Picture
    33,995 Most Valuable Professional on at
    You can turn the outputs of both the Search for Users v2 and the list the members of a tag action into two arrays which you can compare. You can use the except method described in this article from Damien Bird:
     
    Below is an example adapted to your setup.
     
    1. User a Filter Array to look for the MWL department (this saves you one loop)
     
    2. Use a Select to only retrieve the User Id
     
    3. Use another Select after the list members of tag to grab the User ids of that list
     
    4. Use a second Filter Array to compare the two arrays and search for the missing items. In the From the output is used of the Select - Users action. The below is the filter (in advanced mode)
    @not(contains(body('Select_-_Tag_Members'), item()))
     
    5. The apply to each loop uses the body of the second filter array action
     



    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, Bluesky profile or Youtube Channel

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 253 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 172 Super User 2026 Season 2

#3
trice602 Profile Picture

trice602 134 Super User 2026 Season 2

Last 30 days Overall leaderboard