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 / Collect user list for ...
Power Apps
Unanswered

Collect user list for offline app

(0) ShareShare
ReportReport
Posted on by 168

I am building an offline app but need to collect a list of all the Office365 users.
I can collect the first 999 users with 

 

ClearCollect(
 employees,
 Office365Users.SearchUserV2(
 {
 top: 999
 }
 )
)

 

but how do I collect the rest? (we have about 3500 users)

Categories:
  • AllanDeCastro Profile Picture
    412 Most Valuable Professional on at

    Hello,

    Hello,

    Have you tried to define a value greater than 1000 ?

    According to the documentation, this is not a limit of 1000, but a default value, maybe the documentation is not correct, but would love to confirm it first with you:

    AllanDeCastro_0-1711392230409.png

     

  • AngusWalker Profile Picture
    168 on at

    @AllanDeCastro Yes. I tried 2000, but then I get nothing.

  • AllanDeCastro Profile Picture
    412 Most Valuable Professional on at

    I would recommend you to open a Support Request so, as I'm not sure that the documentation is aligned. 

  • AngusWalker Profile Picture
    168 on at

    @AllanDeCastro it says that 1000 is the maximum, but I guess someone at Microsoft used a < instead of a <= because the most you can get is 999.
    There are lots of examples if you google it (And search on here) where it shows 999 is the max.

    However, I have discovered there is a skipToken that returns the next 999:

    Clear(employees);
    Collect(
     employees,
     Office365Users.SearchUserV2({isSearchTermRequired: "No", top: 999}).value
    );
    Set(employees1_skip, Last(Split(Office365Users.SearchUserV2({isSearchTermRequired: "No"}).'@odata.nextLink',"=")).Value);
    Collect(
     employees,
     Office365Users.SearchUserV2({isSearchTermRequired: "No", skipToken: employees1_skip}).value
    );
    Set(employees2_skip, Last(Split(Office365Users.SearchUserV2({isSearchTermRequired: "No", skipToken: employees1_skip}).'@odata.nextLink',"=")).Value);
    Collect(
     employees,
     Office365Users.SearchUserV2({isSearchTermRequired: "No", skipToken: employees2_skip}).value
    );
    ...

    However, I am getting all the service and resource accounts, so I am finding thousands more records than just the 3500 I need.
    I can filter the records I need but only after I capture them all.
    I need to construct some sort of loop, but without being able to use 'Set' in a 'ForAll' loop, this is proving difficult.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 330

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard