Reputation: 47
We have Azure AD with more than 20k users. I am trying to read all those users with properties such as displayName, city, accountName, department. I am not able to read all users. I am using the skiptoken to get all users, still I am getting each time only few thousands not all users.
Here is my sample code for extracting skiptoken:
public static string ExtractSkipToken(string responseString)
{
if (responseString.Contains("skiptoken=X"))
{
var startString = "skiptoken=X'";
var endString = "'";
var startIndex = responseString.IndexOf(startString, StringComparison.Ordinal);
var subText = responseString.Substring(startIndex + startString.Length);
var endIndex = subText.IndexOf(endString, StringComparison.Ordinal);
var skipToken = subText.Substring(0, endIndex);
return skipToken;
}
return string.Empty;
}
Has anyone done that?
Upvotes: 1
Views: 363
Reputation: 1193
The Azure AD Graph API supports paging as described in this document. The idea is that the link to the next page of results is provided in the response from the current page. I would recommend not parsing out the skiptoken manually, but rather using the provided link in the JSON response.
If you are following this pattern and the paging is not behaving as expected, please provide more detail on where the paging goes wrong.
Upvotes: 1