[英]Retrieving Flagged Emails/Messages via O365 Rest API
Does anyone know how to search for a user's flagged emails using the Outlook REST API? 有谁知道如何使用Outlook REST API搜索用户的已标记电子邮件?
The solution here: Flagged messages via Office 365 REST API? 解决方案: 通过Office 365 REST API标记邮件? no longer seems to work.
似乎不再起作用。 I've tried various versions of it with no luck.
我尝试过各种版本,但没有运气。 That solution does return without errors, but all I get are the first 10 messages in the user's inbox.
该解决方案确实返回了没有错误,但是我得到的只是用户收件箱中的前10条消息。
AidaNow is correct about the referenced link, it is not a filter. AidaNow关于引用的链接是正确的,它不是过滤器。 To filter for flagged messages, the recommended way would be to use the beta version of the API, which added the
Flag
property. 要过滤标记的消息,建议的方法是使用API的beta版本,该API版本添加了
Flag
属性。 Then you can filter like this: 然后,您可以像这样进行过滤:
GET https://outlook.office.com/api/beta/me/mailfolders/inbox/messages?$filter=Flag/FlagStatus eq 'Flagged'
the solution in your referenced link is about expanding the flag property of a message when you are using a filter to get the messages, not filtering messages using the flag property. 您引用的链接中的解决方案是关于在使用过滤器获取消息时扩展消息的flag属性,而不是使用flag属性来过滤消息。 For example, in your case, you will get 10 messages in the response and each message may or may not have the 'SingleValueExtendedProperties' property, here is the rule:
例如,在您的情况下,您将在响应中获得10条消息,并且每条消息可能具有或可能不具有'SingleValueExtendedProperties'属性,这是以下规则:
if(message.SingleValueExtendedProperties == undefined){
console.log(email has not been flagged/unflagged)
}else if(message.SingleValueExtendedProperties[0].Value == 2){
console.log('email is flagged')
}else if(message.SingleValueExtendedProperties[0].Value == 1){
console.log('email has been unflagged')
}
Back to your question about filtering using flag property, I have not seen any api call for that, but I will update my answer if I find any. 回到您有关使用flag属性进行过滤的问题,我还没有看到对此的任何api调用,但是如果发现任何问题,我都会更新答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.