ne Filter Operator Not Working as Expected in Microsoft Graph for Managed Devices

Ajay 20 Reputation points
2025-11-26T11:03:19.1666667+00:00

Hi everyone,

I’m running into an issue when using the ne (not equal) operator in Microsoft Graph queries—specifically when filtering managedDevices by the deviceCategoryDisplayName field.

graph_issue I’m attempting to run the following query in Graph Explorer:

https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?
$filter=(deviceCategoryDisplayName ne 'Waiting for Disposal')
&$select=deviceCategoryDisplayName,enrolledDateTime,managedDeviceName

Graph Explorer flags the filter as an error, but if I ignore the warning and run the query anyway, the results return devices that match “Waiting for Disposal”, instead of excluding them. In other words, the ne operator behaves as if it were eq.

The response looks like this:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#deviceManagement/managedDevices(deviceCategoryDisplayName,enrolledDateTime,managedDeviceName)",
    "@odata.count": 1,
    "value": [
        {
            "deviceCategoryDisplayName": "Waiting for Disposal",
            "enrolledDateTime": "2025-02-09T06:29:00Z",
            "managedDeviceName": "Windows VM"
        }
    ]
}

Expected behavior: — Return all devices except those with deviceCategoryDisplayName = "Waiting for Disposal".

Actual behavior: — Returns devices with that value.

I’ve also confirmed:

The field is filterable.

Other operators (e.g., eq) work correctly.

The issue occurs both in Graph Explorer and when calling the API programmatically.

Has anyone else encountered this? Is this a known bug with the ne operator or is there something I’m missing about how filtering works on this resource type?

Any insights would be greatly appreciated!

Thanks!

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Answer accepted by question author
  1. Vasil Michev 123.7K Reputation points MVP Volunteer Moderator
    2025-11-26T11:43:05.39+00:00

    The Graph has limited filtering capabilities overall, and the fact that a given endpoint/property supports $filter, does not mean all operators are supported. In the case of deviceCategoryDisplayName, the documentation states:

    Supports $filter operator 'eq' and 'or'.

    so you cannot use -ne or other operators.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.