hey @Iantaylor2050
can u try this?
// When the button is clicked
Clear(colAllUsers); // Clear the existing collection
Set(varPageNumber, 1); // Initialize the page number
Set(varHasMore, true); // Initialize the control variable
// Start the process
Collect(colAllUsers, Office365Users.SearchUser({searchTerm:"", top:999}));
Set(varPageNumber, varPageNumber + 1);
// Use this in a button or other control to continue fetching users
If(
varHasMore,
Collect(
colAllUsers,
Office365Users.SearchUser({searchTerm:"", top:999, skip: (varPageNumber - 1) * 999})
);
// Check if less than 999 users were returned, indicating the end of the data
If(
CountRows(Last(colAllUsers)) < 999,
Set(varHasMore, false)
);
Set(varPageNumber, varPageNumber + 1)
);
// After all data is fetched, you can filter the users as needed
colFilteredUsers = Filter(
colAllUsers,
"Manager" in JobTitle || "Associate" in JobTitle || "Director" in JobTitle || "Accountant" in JobTitle
);
Let me know if my answer helped solving your issue.
If it did please accept as solution and give it a thumbs up so we can help others in the community.
Greetings