Forum Discussion

ktchoumak's avatar
ktchoumak
Copper Contributor
Sep 17, 2021

List of printers limited by number of printers page by 100!

Getting list of universal printers from Azure by next code:

            var queryOptions = new List<QueryOption>
            {
                new QueryOption("$top", "300")
            };

            var printerItems = await ApplicationGraphClient.Print.Printers
                .Request(queryOptions)
                .Filter(filter)
                .Select(x => new
                {
                    x.Id,
                    x.DisplayName
                })
                .GetAsync();

If I increase above 100 like 300 - it still returns 100 items.

Is this hardcoded for UP API?

If I use 10 - it works - so code is valid.

P.S. I know I can use pagination but I'm interested to increase the page size

  • Getting too many printers at the same time will slow down the response. We recommend using pagination.
    Are you writing an application? We also recommend to save multiple queries by caching the printer list and updating the cache only periodically. Similarly you can cache the printer's capabilities.
    • ktchoumak's avatar
      ktchoumak
      Copper Contributor
      If you read my code - I'm getting very limited information, and getting even 10-20K printers in a list - not a big load.

      You also can see my P.S. about my question.
      • Saurabh_Bansal's avatar
        Saurabh_Bansal
        Icon for Microsoft rankMicrosoft

        ktchoumak Before getting printers list, we need to perform multiple operations including checking user access. These operations can be time consuming - thats why we ask partners to pull the list in batches (with pagination).

         

        Thanks

        Saurabh

Share