c# - 微软图形API : $filter & $search not working together

标签 c# azure outlook microsoft-graph-api azure-ad-graph-api

我正在使用图形 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/

相关文章:

c# - 添加内容类型的新实例时如何显示内容部分的字段?

c# - 存储大量分析数据

azure - Instagram ?__a=1 查询 : Why do I get login page instead of JSON?

asp.net - 为什么我的 WebRole 在 WaWebHost 而不是 IIS 上运行

html - Outlook 2003 剥离文本装饰 - HTML 电子邮件

c# - 如何以编程方式确定从主页功能区创建的 Outlook 新项目 --> 新项目

c# - 通过 C# 修改 Outlook OFT 文件

c# - MySql gridview删除命令

c# - 什么是支持 LINQ 的 "mobile".NET 数据库?

c# - 如何从 Visual Studio 中的包管理器控制台针对 SQL Azure 调用更新数据库?