通过Office 365 REST API标记的邮件? [英] Flagged messages via Office 365 REST API?

查看:88
本文介绍了通过Office 365 REST API标记的邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种检测&使用Office 365 REST消息API设置电子邮件的已标记"状态.我看不到标记"列为 REST消息,尽管我确实将它列在

I'm looking for a way to detect & set the 'flagged' status of an email using the Office 365 REST Message API. I don't see 'Flag' listed as a property of a REST Message, though I do see it listed under Exchange Web Services.

我尝试进行REST调用,将Flag添加到过滤后的属性以及SingleValueExtendedProperties和MultiValueExtendedProperties之类,

I've attempted to make a REST call adding Flag to filtered properties, as well as SingleValueExtendedProperties and MultiValueExtendedProperties like:

/folders/inbox/messages?$top=50&$select=Subject,...,Flag
/folders/inbox/messages?$top=50&$select=Subject,...,SingleValueExtendedProperties
/folders/inbox/messages?$top=50&$select=Subject,...,MultiValueExtendedProperties

所有这些都以某种形式返回:

all of these have come back with some form of:

{"error":{"code":"RequestBroker-ParseUri","message":"Could not find a property named \\\'Flag\\\' on type \\\'Microsoft.OutlookServices.Message\\\'."}}

关于如何通过REST API访问Outlook标志"属性的任何建议?

Any suggestions on how to get access to the Outlook 'Flag' property via the REST API?

推荐答案

更新:/beta端点上的Message上现在有一个Flag属性.这是推荐的方法.我将其他信息留在此处用于历史目的,以帮助人们尝试设置其他扩展属性.

UPDATE: There is now a Flag property on Message on the /beta endpoint. This is the recommended way to do this. I'll leave the other information there for historical purposes and to help folks trying to set other extended properties.

现在,您可以更轻松地获取/设置标志状态. Message实体现在具有类型为FollowupFlagFlag属性. (如果在该链接上看不到它,请确保在页面顶部选择beta版本.)

Now you can get/set flag status much easier. The Message entity now has a Flag property of type FollowupFlag. (If you don't see it at that link, be sure that the beta version is selected at the top of the page).

您可以通过发送带有以下有效负载的PATCH将消息标记为已标记:

You can mark a message as flagged by sending a PATCH with the following payload:

{
  "Flag": {
    "FlagStatus": "Flagged"
  }
}


旧方法(使用扩展属性)

注意:我们最近进行了更改,以简化扩展属性格式.现在,此更改将推广到服务器,所以我已经 在此答案中添加了新格式.我已经保留了旧格式,以防万一 任何人都在访问尚未应用更新的邮箱. 如果使用旧格式,则会出现错误:

Note: We recently made a change to simplify the extended properties format. This change is rolling out to servers now, so I've added the new format to this answer. I've left the old format in case anyone is accessing mailboxes that haven't had the update applied yet. If using the old format and you get an error:

"Could not find a property named 'PropertyRef' on type 
'Microsoft.OutlookServices.SingleValueLegacyExtendedProperty'."

您需要使用新格式.

您需要做的是包括一个$expand查询参数以扩展SingleValueExtendedProperties集合,并带有一个$filter子参数以指示要包括的属性.在这种情况下,您需要 PidTagFlagStatus .尝试这样的查询:

What you need to do is include an $expand query parameter to expand the SingleValueExtendedProperties collection, with a $filter sub-parameter to indicate the property you want to include. In this case, you want PidTagFlagStatus. Try a query like this:

新格式:

api/beta/me/messages?$select=Subject,SingleValueExtendedProperties&$expand=SingleValueExtendedProperties($filter=PropertyId eq 'Integer 0x1090')

旧格式:

api/beta/me/messages?$select=Subject,SingleValueExtendedProperties&$expand=SingleValueExtendedProperties($filter=(PropertyRef eq '0x1090' and Type eq Microsoft.OutlookServices.MapiPropertyType'Integer'))

根本没有标记的消息将不会返回该属性.确实会显示如下消息:

Messages that aren't flagged at all will just not have that property returned. Messages that do will look something like this:

新格式:

{
  "@odata.id": "https://outlook.office365.com/api/beta/Users('JasonJ@jasonjohdemo.onmicrosoft.com')/Messages('AAMkAGQ4Yzc2NDkwLTYxYmItNDZmYS1iZjI1LTYyNmY4NTZkMjI1NgBGAAAAAADwPSus7EwaR6q1wNtgoqEMBwDpfBfj8UPUTqu4bEwGpnFMAAAAAAEgAADpfBfj8UPUTqu4bEwGpnFMAAAjCUJGAAA=')",
  "@odata.etag": "W/\"CQAAABYAAADpfBfj8UPUTqu4bEwGpnFMAAAjCzND\"",
  "Id": "AAMkAGQ4Yzc2NDkwLTYxYmItNDZmYS1iZjI1LTYyNmY4NTZkMjI1NgBGAAAAAADwPSus7EwaR6q1wNtgoqEMBwDpfBfj8UPUTqu4bEwGpnFMAAAAAAEgAADpfBfj8UPUTqu4bEwGpnFMAAAjCUJGAAA=",
  "Subject": "Test Flag",
  "SingleValueExtendedProperties@odata.context": "https://outlook.office365.com/api/beta/$metadata#Me/Messages('AAMkAGQ4Yzc2NDkwLTYxYmItNDZmYS1iZjI1LTYyNmY4NTZkMjI1NgBGAAAAAADwPSus7EwaR6q1wNtgoqEMBwDpfBfj8UPUTqu4bEwGpnFMAAAAAAEgAADpfBfj8UPUTqu4bEwGpnFMAAAjCUJGAAA%3D')/SingleValueExtendedProperties",
  "SingleValueExtendedProperties": [
    {
      "PropertyId": "Integer 0x1090",
      "Value": "2"
    }
  ]
}

旧格式:

{
  "@odata.id": "https://outlook.office365.com/api/beta/Users('JasonJ@jasonjohdemo.onmicrosoft.com')/Messages('AAMkAGQ4Yzc2NDkwLTYxYmItNDZmYS1iZjI1LTYyNmY4NTZkMjI1NgBGAAAAAADwPSus7EwaR6q1wNtgoqEMBwDpfBfj8UPUTqu4bEwGpnFMAAAAAAEgAADpfBfj8UPUTqu4bEwGpnFMAAAjCUJGAAA=')",
  "@odata.etag": "W/\"CQAAABYAAADpfBfj8UPUTqu4bEwGpnFMAAAjCzND\"",
  "Id": "AAMkAGQ4Yzc2NDkwLTYxYmItNDZmYS1iZjI1LTYyNmY4NTZkMjI1NgBGAAAAAADwPSus7EwaR6q1wNtgoqEMBwDpfBfj8UPUTqu4bEwGpnFMAAAAAAEgAADpfBfj8UPUTqu4bEwGpnFMAAAjCUJGAAA=",
  "Subject": "Test Flag",
  "SingleValueExtendedProperties@odata.context": "https://outlook.office365.com/api/beta/$metadata#Me/Messages('AAMkAGQ4Yzc2NDkwLTYxYmItNDZmYS1iZjI1LTYyNmY4NTZkMjI1NgBGAAAAAADwPSus7EwaR6q1wNtgoqEMBwDpfBfj8UPUTqu4bEwGpnFMAAAAAAEgAADpfBfj8UPUTqu4bEwGpnFMAAAjCUJGAAA%3D')/SingleValueExtendedProperties",
  "SingleValueExtendedProperties": [
    {
      "PropertyRef": "0x1090",
      "Type": "Integer",
      "Value": "2"
    }
  ]
}

设置标志就像在SingleValueExtendedProperties集合中向具有该属性的消息发送PATCH一样简单:

Setting the flag is as simple as sending a PATCH to the message with that property in the SingleValueExtendedProperties collection:

新格式:

PATCH https://outlook.office365.com/api/beta/me/messages/{id}

{
  "SingleValueExtendedProperties": [
    {
      "PropertyId": "Integer 0x1090",
      "Value": "2"
    }
  ]
}

旧格式:

PATCH https://outlook.office365.com/api/beta/me/messages/{id}

{
  "SingleValueExtendedProperties": [
    {
      "PropertyRef": "0x1090",
      "Type": "Integer",
      "Value": "2"
    }
  ]
}

最后,根据 MS-OXOFLAG ,值2表示已标记要跟踪,值1表示已完成标记.

Finally, per MS-OXOFLAG, a value of 2 means flagged for follow up, and 1 means flag completed.

这篇关于通过Office 365 REST API标记的邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆