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 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:
I have the same question (0)
  • 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

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard