Freigeben über

How can I create an AND search with $search with Microsoft Graph?

Martin Schneider 0 Zuverlässigkeitspunkte
2024-08-30T15:23:39.4233333+00:00

Hello together,

 

i'm building a programm that is communicating with the /users/{user-id}/messages endpoint of the graph api. Some of the mail properties can not be filtered with the $filter paramter like to recipients and cc recipients.

After a few tests in Graph Explorer, I am now certain that the search using the $search odata query parameter does not work as described at https://learn.microsoft.com/en-us/graph/search-query-parameter?tabs=csharp#using-search-on-message-collections.

I use the following query:

https://graph.microsoft.com/v1.0/users/{user-id}/messages?$search="to:bruce" AND "importance:normal"&$select=toRecipients,importance  

my first result is the following:

{         

“@odata.etag“: ‘W/\’CQAAABYAAAA2mv7+M3xWRYv5FnnjBvgGAAASla3V\””,

`` ``            “id": ‘SOME ID’,

`` ``            “importance": ‘high’,

`` ``            “toRecipients": [

`` ``                {`` ``                    “emailAddress": {

`` ``                        “name": ‘Bruce Banner’,

`` ``                        “address": ”******@contoso.com”

`` ``                    }`` ``                }

`` ``            ]

`` ``        },

}

Why is the importance high in the result? The query should only find emails in which the importance is set to normal. I am not only getting incorrect results with this combination. The same happens when I combine cc: and to: via AND and much more....

Can I only use AND and OR to directory object collections?

Greetings Martin

PS: I can't use the search query API endpoint, because searching delegate mailboxes is not supported: https://learn.microsoft.com/en-us/graph/search-concept-messages#known-limitations

Gemeindehaus | Besprechen der F&A-Website | Erste Schritte mit F&A
0 Kommentare Keine Kommentare
{count} Stimmen

Ihre Antwort

Antworten können von Fragestellenden als „Angenommen“ und von Moderierenden als „Empfohlen“ gekennzeichnet werden, wodurch Benutzende wissen, dass diese Antwort das Problem des Fragestellenden gelöst hat.