none
Azure Active Directory: paging the filtering result, possible?

    Question

  • I created 500 users with initial letter "a" in Azure Active Directory, then perform a search

    "users = (DataServiceQuery<User>)(users.Where(user => user.displayName.StartsWith('a')));"

    which yields result of 100 rows, then I further use the "Continuation().NextLinkUri" trying to navigate to the next 100 users with initial letter "a", then get the exception as following

    "No paging is possible with this query. Query for all resources or narrow the search scope by changing the query filter"

    Example of Continuation URL: https://graph.windows.net/ad26388d-e77e-47af-a9bb-b13275b55a22/directoryObjects/$/Microsoft.WindowsAzure.ActiveDirectory.User?$filter=startswith(displayName,'a')&$skiptoken=X'2A02AABE6030EB4582D952656D7A5733'

    so here is the question, is that possible to combine filter and paging within one single request? (I guess not possible, which is indicated by the exception message, but please confirm)


    if it is not possible, then the code here is incorrect

    http://code.msdn.microsoft.com/windowsazure/Write-Sample-App-for-79e55502

    because the Continuation URL from a filtering response will always yield exception...

    regards

    Mark




    Friday, January 10, 2014 1:11 PM

Answers

  • Hi Mark, we don't support paging with filtered queries today.  However, we are making changes that will address this in the next few weeks (change will get deployed into our production system).   If you see a skiptoken value returned equal to X'2A02AABE6030EB4582D952656D7A5733' (a well known value).  The work around today, is to ignore this skip token (i.e. don't attempt getting the next page result  using it).  You can specify a max page size (999 objects) for filtered queries, for exmaple:  https://graph.windows.net/contoso.com/users?$top=999&$filter=startswith(displayName, 'a')&api-version=2013-04-05

    If you do receive a skiptoken in the response to this query and it contains the well known value, then your code should realize that there are more results, but should not attempt to use it to get the next page.  Example:odata.nextLink=directoryObjects/$/Microsoft.WindowsAzure.ActiveDirectory.User?$filter=starwith(displayname,'a')&$skiptoken=X'2A02AABE6030EB4582D952656D7A5733' 

    Of course, once we address this in production and support filtered, pages searches, then you can use the skiptoken to get set of pages.


    Edward Wu

    • Marked as answer by Mark-Chen Monday, January 13, 2014 10:55 PM
    Monday, January 13, 2014 9:28 PM
    Moderator

All replies

  • Hi Mark,

    Thanks for posting!

    According to your description, it seems the issue is related to Azure AD, I will move this thread to Azure AD Discussions forums to get a better support.

    Regards,

    Will


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, January 13, 2014 7:47 AM
    Moderator
  • Hi Mark, we don't support paging with filtered queries today.  However, we are making changes that will address this in the next few weeks (change will get deployed into our production system).   If you see a skiptoken value returned equal to X'2A02AABE6030EB4582D952656D7A5733' (a well known value).  The work around today, is to ignore this skip token (i.e. don't attempt getting the next page result  using it).  You can specify a max page size (999 objects) for filtered queries, for exmaple:  https://graph.windows.net/contoso.com/users?$top=999&$filter=startswith(displayName, 'a')&api-version=2013-04-05

    If you do receive a skiptoken in the response to this query and it contains the well known value, then your code should realize that there are more results, but should not attempt to use it to get the next page.  Example:odata.nextLink=directoryObjects/$/Microsoft.WindowsAzure.ActiveDirectory.User?$filter=starwith(displayname,'a')&$skiptoken=X'2A02AABE6030EB4582D952656D7A5733' 

    Of course, once we address this in production and support filtered, pages searches, then you can use the skiptoken to get set of pages.


    Edward Wu

    • Marked as answer by Mark-Chen Monday, January 13, 2014 10:55 PM
    Monday, January 13, 2014 9:28 PM
    Moderator