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 / GET ALL USER FORM OFFI...
Power Apps
Answered

GET ALL USER FORM OFFICE 365

(0) ShareShare
ReportReport
Posted on by

I already tried with the user filter from the office 365 connector, but I want to get all users and their data (there are more than 5000 users)

Categories:
I have the same question (0)
  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Gorilla_8 ,

     

    Could you tell me:

    Did your formula return a nextlink?

     

    vxiaochenmsft_0-1651831708546.png

     

    Best Regards,

    Wearsky

     

  • Gorilla_8 Profile Picture
    on at

    @v-xiaochen-msft 

     

    Yes, indeed, what I do?

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Gorilla_8 ,

     

    The function has a parameter called skiptoken.

    vxiaochenmsft_0-1652059997184.png

     

    Please try to add the whole nextlink or a part of it into this parameter.

     

    Best Regards,

    Wearsky

  • Gorilla_8 Profile Picture
    on at

    ok, @v-xiaochen-msft  so what I do with this information?

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Gorilla_8 ,

     

    vxiaochenmsft_0-1652235583047.png

     

    Best Regards,

    Wearsky

     

  • Gorilla_8 Profile Picture
    on at

    Ok, @v-xiaochen-msft 

    This my code:


    Clear(colAllUsers);;ClearCollect(colAllUsers; Office365Users.SearchUserV2({skipToken:"RFNwd......"}).value)

    He returned 999 users, not all users...

    If I try with this:

    Clear(colAllUsers);;ClearCollect(colAllUsers; Office365Users.SearchUserV2({searchTerm:""; skipToken:"RFNwd......"}).value)

    The same result

     

     

    How can I get all users?

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Gorilla_8 ,

     

    It will return 999 users at a time.

    You need to use a new nextlink to get more users.

    vxiaochenmsft_0-1652320233949.png

     

    Best Regards,

    Wearsky

  • Gorilla_8 Profile Picture
    on at

    @v-xiaochen-msft 

     

    Ok, so I do this:

    Clear(colAllUsers);;
    ClearCollect(
     colAllUsers;
     Office365Users.SearchUserV2(
     {
     top: 999
     }
     ).value;
     ClearCollect(
     colAllUsers;
     Office365Users.SearchUserV2(
     {
     top: 999
     }
     ).value;
     ClearCollect(
     colAllUsers;
     Office365Users.SearchUserV2(
     {
     top: 999
     }
     ).value;
     ClearCollect(
     colAllUsers;
     Office365Users.SearchUserV2(
     {
     top: 999
     }
     ).value
     )
     )
     )
    )

     

    And returned 1998, is somenthing wrong?

  • Gorilla_8 Profile Picture
    on at

    @v-xiaochen-msft 

     

    I checked and its duplicate the users

  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Gorilla_8 ,

     

    I did a sample for you.

    1\ Add a button control and set its onselect property to:

    Clear(Col);Set(varNextlink,Blank());Set(varNextlinkTemp,Blank());Set(varSkiptoken,"");With(Office365Users.SearchUserV2({searchTerm:""}),Collect(Col,ThisRecord.value);Set(varNextlink,ThisRecord.'@odata.nextLink');Set(varSkiptoken,Mid(varNextlink,Find("skipToken",varNextlink)+10)));Set(varNextlinkTemp,varNextlink)

     

    2\ Add a toggle control and set its Default property to:

    If(varNextlinkTemp=Blank(),true,varNextlinkTemp=varNextlink,false,true)

     

    Set the toggle's OnCheck property to:

    Set(varNextlinkTemp,varNextlink)

     

    Set the toggle's OnUncheck property to:

    If(varNextlink=Blank()&&varNextlinkTemp=Blank(),Blank(),With(Office365Users.SearchUserV2({searchTerm:"",skipToken:varSkiptoken}),Collect(Col,ThisRecord.value);Set(varSkiptoken,Mid(ThisRecord.'@odata.nextLink',Find("skipToken",ThisRecord.'@odata.nextLink')+10));Set(varNextlink,ThisRecord.'@odata.nextLink')))

     

    Set the toggle's visible property to:

    false

     

    Best Regards,

    Wearsky

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 899

#2
Valantis Profile Picture

Valantis 571

#3
11manish Profile Picture

11manish 499

Last 30 days Overall leaderboard