Filter "Endswith" results in "The query filter contains one or more invalid nodes." Error

N&H / Kaba 0 Reputation points
2024-07-10T07:17:43.37+00:00

I am trying to filter Messages where the subject ends with a certain value but i am getting the error in the title.

I tried the Query in the Graph explorer and the SDK (opened an issue there first: https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/2572)

346978058-7c068c11-35c7-401f-90a7-12087d020bd2

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

2 answers

Sort by: Most helpful
  1. CarlZhao-MSFT 46,376 Reputation points
    2024-07-10T08:59:20.5566667+00:00

    Hi @N&H / Kaba

    The endswith filter on the "subject" property is not yet supported. As an alternative, you can try the $search query parameter.

    var result = await graphClient.Users["{user_id}"].MailFolders["{folder_id}"].Messages.GetAsync((requestConfiguration) =>
    {
        requestConfiguration.QueryParameters.Search = "\"subject:Digest\"";
    });
    

    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.

    0 comments No comments

  2. N&H / Kaba 0 Reputation points
    2024-07-10T09:28:07.41+00:00

    Hi,

    thanks for the answer.

    Why is StartsWith supported but not EndsWith?

    How would i realise the endswith with search? I need to be able to filter for subjects that end with a specific value. This value can also appear somewhere in the middle of the subject or the start, but i only need the ones where it ends with the specified value.

    0 comments No comments

Your answer

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