Hello All,
I am getting 504 Gateway Time-out Error when fetching B2C Users List which is >80K. The same worked fine for around 4k users, with a little wait, and works even more smooth with less than 2k users while testing.
Is there any suggestion to handle such huge Users List? Code snippet is below:
public async Task<List<User>> GetAllUsers()
{
List<User> userResult = new List<User>();
UsersModel signin = new UsersModel();
var graphClient = await GetGraphServiceClientAsync();
var users = await graphClient.Users.Request().Top(999).Select(e => new
{
e.DisplayName,
e.CreatedDateTime,
e.Id,
e.Identities,
e.UserPrincipalName,
e.OtherMails,
e.Mail
}
).GetAsync().ConfigureAwait(true);
userResult.AddRange(users.CurrentPage.OrderBy(e=>e.CreatedDateTime));
while(users.NextPageRequest!=null)
{
users = await users.NextPageRequest.GetAsync();
userResult.AddRange(users.CurrentPage.OrderBy(e=>e.CreatedDateTime));
}
return userResult;
}