如何通过附件名称或主题使用“Microsoft Graph”rest API过滤outlook消息?(How to filter outlook messages by attachment name

编程入门 行业动态 更新时间:2024-10-11 15:14:58
如何通过附件名称或主题使用“Microsoft Graph”rest API过滤outlook消息?(How to filter outlook messages by attachment name or subject using “Microsoft Graph” rest API?)

我们已经使用Microsoft Graph API将Outlook与我们的iOS应用程序集成在一起。 我们有一个用例,我们必须通过附件名称或主题过滤Outlook消息。 我们正在使用查询参数来打图API。

链接到Microsoft文档。

根据上述文档, $search参数用于过滤Outlook邮件。 什么时候在API下面,我们得到错误的回应。 它会返回邮件主题和邮件正文中都含有“测试邮件”的邮件。 但它应该只返回主题为“测试邮件”的邮件。

https://graph.microsoft.com/v1.0/me/messages?$search="subject:Test Mail”

当我们通过点击下面的API来按附件名称过滤邮件时,我们遇到了同样的问题。 事实上,我们在这种情况下得到了一个空的回应。

https://graph.microsoft.com/v1.0/me/messages?$search=“attachments:test.png”

上述URL形成是否正确? 为什么我们没有得到期望的回应? 请帮助我们解决这个问题。

We have integrated outlook to our iOS application using Microsoft Graph API. We have a use case where we have to filter outlook messages by attachment name or by subject. We are using query parameters to hit graph API.

Link to microsoft documentation.

As per above documentation, $search parameter is used to filter outlook messages. When are hitting below API, we are getting wrong responses. It’s returning messages which have “Test Mail” in both subject and message body. But it should return only the messages whose subject line is “Test Mail”.

https://graph.microsoft.com/v1.0/me/messages?$search="subject:Test Mail”

The same problem we are facing when we filter messages by attachment name, by hitting below API. In fact we are getting a empty response in this case.

https://graph.microsoft.com/v1.0/me/messages?$search=“attachments:test.png”

Is the above URL formation is correct? Why we’re not getting desired response? Please help us out on this.

最满意答案

仅用于搜索主题,您可以使用:

/v1.0/me/messages?$search="subject:search term"

或过滤器:

/v1.0/me/messages?$filter=contains(subject, 'my search term')

(在这种方法中,搜索项必须与主题字符串的一部分完全匹配)

仅用于搜索附件,您必须使用关键字“附件”而不是“附件”( 交换文档 ):

/v1.0/me/messages?$search="attachment:search term"

For searching Subject only, you can use:

/v1.0/me/messages?$search="subject:search term"

or a filter:

/v1.0/me/messages?$filter=contains(subject, 'my search term')

(in this method the search term must exactly match a portion of the subject string)

For searching attachments only, you must use the keyword 'attachment' instead of 'attachments' (exchange documentation):

/v1.0/me/messages?$search="attachment:search term"

更多推荐

本文发布于:2023-08-04 12:04:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1415687.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:附件   名称   消息   主题   Graph

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!