Processing failed:Invalid filter clause: Syntax error

carlos carreno 105 Reputation points

When running my code with filters brought from MS Graph Explorer, the following error appears: "Processing failed: Invalid filter clause: Syntax error."

var graphClient = new GraphServiceClient(clientSecretCredential, scopes);
                var devices = await graphClient.Devices.GetAsync((requestConfiguration) =>
                    requestConfiguration.QueryParameters.Filter = "startswith(operatingSystem,'Win'),profileType eq 'RegisteredDevice',mdmAppId ne null"; // Corrected line
                    requestConfiguration.QueryParameters.Count = true;
                    requestConfiguration.Headers.Add("ConsistencyLevel", "eventual");

Everything is according to what MS Graph has provided me. Could you help me because it's throwing that error? Thank you.

User's image

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,186 questions
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 32,276 Reputation points

    Hi @carlos carreno

    From my testing, it seems that filtering the mdmAppId attribute is not supported. As a solution, try getting the device set and filtering it locally.

    Code example:

    var devices = await graphClient.Devices.GetAsync();
    foreach (var device in devices.Value) {
        if (device.OperatingSystem.StartsWith("Win") && device.ProfileType is "RegisteredDevice" && device.MdmAppId != null) {

    User's image

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.