ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,212 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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;
}