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 Apps / Office 365 Search does...
Power Apps
Answered

Office 365 Search does not show all results in collection

(2) ShareShare
ReportReport
Posted on by 938
Hey all - I have a collection to get my active users for my company based on the - from a department - does not look like its returning all though - the collection stops at the letter "I" - this user below starts with the letter R and is not in the collection  can anyone share with me what I am missing?  Thank you
 
Both these options return the same records 
 
ClearCollect(
    colAllUsers,
    Filter(
      Office365Users.SearchUserV2({isSearchTermRequired: false, top: 999}).value,
      Department = "Global Operations" && AccountEnabled && !("#EXT#" in UserPrincipalName)
   )
);
 
ClearCollect(
 colEmployeesOSF,
Filter(
   
Office365Users.SearchUser({
searchTerm:"",
top: 999
}),
!IsBlank(DisplayName) && Department = "Global Operations" && AccountEnabled && !("#EXT#" in UserPrincipalName)
))
 
 
Categories:
I have the same question (0)
  • Suggested answer
    WarrenBelz Profile Picture
    155,838 Most Valuable Professional on at
    The issue I suspect is that you have more than 999 users in your organisation, which is the data set returned before the filters are applied (so you are only ever filtering from this limited sample).
     
    There is an alternative with a Flow, but the code below works fine for me when tested here - example for 4,000 - 5,000 users (just change the Sequence number for more/less).
    Clear(colAllUsers);
    ForAll(
       Sequence(5),
       Collect(
          colAllUsers,
          Filter(
             Office365Users.SearchUserV2(
                {
                   IsSearchTermRequired: false,
                   top: 999,
                   skip: (Value - 1) * 999
                }
             ).value,
             Department = "Global Operations" && AccountEnabled && !("#EXT#" in UserPrincipalName)
          )
       )
    );
     
    Please Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like
    Visit my blog
    Practical Power Apps    LinkedIn  
  • Verified answer
    oyepanky Profile Picture
    537 on at

    Hi,
    What you’re experiencing is not an issue with your filter logic — it’s a limitation of the Office365Users connector. Even though you are using. top: 999
     

    Office365Users.SearchUser() and SearchUserV2() do not return all users in the tenant. These functions are internally paginated and typically only return the first batch of users (often sorted alphabetically by DisplayName).

    That’s why your collection appears to stop around users whose names start with “I”. The user starting with “R” simply isn’t included in the first returned page from Azure AD.

    Why This Happens - The Office365Users connector has internal paging limits.

    Solutions

    • Create a Power Automate flow:

    • Use Azure AD – List users

    • Apply OData filter ( department eq 'Global Operations' and accountEnabled eq true )

    • Return the results to PowerApps.

    This avoids pagination limits and is the most scalable solution.


    If it still does not work Pelase Debug Confirmation

     To confirm that pagination is the issue, try:   If it returns a fixed number (often 100), that confirms backend paging.

    CountRows(
        Office365Users.SearchUserV2({
            isSearchTermRequired:false,
            top:999
        }).value
    )
     

    24/7 Power Platform Support - Click Here
    Best regards,
    Pankaj Jangid (OyePanky)
    Power Platform Developer
    YouTube: https://www.youtube.com/@oyepanky
    Website: https://www.dialforit.com

     

     

  • WarrenBelz Profile Picture
    155,838 Most Valuable Professional on at
    A quick follow-up to see if you received the answer you were looking for. Happy to assist further if not.
     
    Please Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn   

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard