Client-side pagination using $skip/$top does not work with Intune

442 views Asked by At

We are currently working on a client application that processes Intune devices by querying all devices on a customer account using the following Microsoft Graph API:

GET https://graph.microsoft.com/v1.0/deviceManagement/managedDevices

After we migrated from our test environment to a Production account we discovered that manual pagination of devices using $skip and $top does not work as per the relevant Microsoft Graph API OData documentation.

As per the said documentation:

  • $skip: Indexes into a result set. Also used by some APIs to implement paging and can be used together with $top to manually page results.

However, the following query returns an empty result despite there being thousands of devices registered on the target customer account:

GET https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?$top=10&$skip=10

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#deviceManagement/managedDevices",
    "@odata.count": 10,
    "@odata.nextLink": "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?$top=10&$skip=10",
    "value": []
}

Also, we found that OData $filter does not work either as demonstrated by the following snippet which queries for devices with operatingSystem equal to 'Android':

GET 'https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?$top=100&filter=operatingSystem%20eq%20%27Android%27'

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#deviceManagement/managedDevices",
    "@odata.count": 100,
    "@odata.nextLink": "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?$top=100&$skip=0&filter=operatingSystem+eq+%27Android%27",
    "value": [
        {
            "id": "5bac965e-25e3-4f99-97fb-da21a280f684",
            "userId": "some-uuid-value",
            "deviceName": "My Iphone",
            "managedDeviceOwnerType": "company",
            "enrolledDateTime": "2020-02-05T09:52:39Z",
            "lastSyncDateTime": "2020-10-19T17:07:20Z",
            "operatingSystem": "iOS",
...

We have tested using both v1.0 and beta versions of the said API to no avail. Has anybody got this working?

0

There are 0 answers