我正在使用图形 API 在收件箱中查找具有特定主题且未读的邮件以下载其附件。通过形成以下 URL,我可以使用 $search 成功搜索具有特定主题的邮件:
https://graph.microsoft.com/v1.0/users/myEmailId/mailFolders/Inbox/messages?$search=%22subject%3ASome%20Daily%20Email%22
我可以使用此 URL 成功过滤未读的消息:
https://graph.microsoft.com/v1.0/users/myEmailId/mailFolders/Inbox/messages?$filter=isread%20eq%20false
但是当我尝试组合两个查询参数时,我收到错误请求异常。我尝试过使用这个网址:
https://graph.microsoft.com/v1.0/users/myEmailId/mailFolders/Inbox/messages?$search=%22subject%3ASome%20Daily%20Email%22&$filter=isread%20eq%20false
我尝试过(我知道它很愚蠢)相反的版本,先放置$filter,然后放置$search。我也尝试过对 URL 中的“&”进行编码。
请告诉我如何通过同时传递 $filter 和 $search 来正确调用 URL。
提前致谢。
最佳答案
$filter 参数在设计上不适用于 $search(请参阅 Microsoft Graph optional query parameters ):
Note: You can currently search messages but not contacts or events. A $search request returns up to 250 results. You cannot use $filter or $orderby in a search request.
关于c# - 微软图形API : $filter & $search not working together,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41116728/