你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Microsoft Outlook 事件
本文提供了由 Microsoft 图形 API 发布的 Microsoft Outlook 事件的属性和架构。 有关事件架构的简介,请参阅 CloudEvents 架构。
可用事件类型
事件名称 | 说明 |
---|---|
Microsoft.Graph.EventCreated | 在 Outlook 中创建事件时触发。 |
Microsoft.Graph.EventUpdated | 在 Outlook 中更新事件时触发。 |
Microsoft.Graph.EventDeleted | 在 Outlook 中删除事件时触发。 |
Microsoft.Graph.ContactCreated | 在 Outlook 中创建联系人时触发。 |
Microsoft.Graph.ContactUpdated | 在 Outlook 中更新联系人时触发。 |
Microsoft.Graph.ContactDeleted | 在 Outlook 中删除联系人时触发。 |
Microsoft.Graph.MessageCreated | 在 Outlook 中创建了邮件时触发。 |
Microsoft.Graph.MessageUpdated | 在 Outlook 中更新了邮件时触发。 |
Microsoft.Graph.MessageDeleted | 在 Outlook 中删除了邮件时触发。 |
示例事件
触发某个事件后,事件网格服务会将有关该事件的数据发送到订阅目标。 本部分包含每个 Outlook 事件的数据外观示例。
Microsoft.Graph.EventCreated 事件
{
"id": "00d8a100-2e92-4bfa-86e1-0056dacd0fce",
"type": "Microsoft.Graph.EventCreated",
"source": "/tenants/<tenant-id>/applications/<application-id>",
"subject": "Events/<event-id>",
"time": "2024-05-22T22:24:31.3062901Z",
"datacontenttype": "application/json",
"specversion": "1.0",
"data": {
"@odata.type": "#Microsoft.OutlookServices.Notification",
"Id": null,
"SubscriptionExpirationDateTime": "2024-06-22T23:56:30.1307708Z",
"ChangeType": "created",
"subscriptionId": "MTE1MTVlYTktMjVkZS00MjY3LWI1YzYtMjg0NzliZmRhYWQ2",
"resource": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Events('<event id>')",
"clientState": "<client state>",
"resourceData": {
"Id": "<event id>",
"@odata.etag": "<tag id>",
"@odata.id": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Events('<event id>')",
"@odata.type": "#Microsoft.OutlookServices.Event",
"OtherResourceData": "<some other resource data>"
}
}
}
Microsoft.Graph.EventUpdated 事件
{
"id": "00d8a100-2e92-4bfa-86e1-0056dacd0fce",
"type": "Microsoft.Graph.EventUpdated",
"source": "/tenants/<tenant-id>/applications/<application-id>",
"subject": "Events/<event-id>",
"time": "2024-05-22T22:24:31.3062901Z",
"datacontenttype": "application/json",
"specversion": "1.0",
"data": {
"@odata.type": "#Microsoft.OutlookServices.Notification",
"Id": null,
"SubscriptionExpirationDateTime": "2024-06-22T23:56:30.1307708Z",
"ChangeType": "updated",
"subscriptionId": "MTE1MTVlYTktMjVkZS00MjY3LWI1YzYtMjg0NzliZmRhYWQ2",
"resource": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Events('<event id>')",
"clientState": "<client state>",
"resourceData": {
"Id": "<event id>",
"@odata.etag": "<tag id>",
"@odata.id": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Events('<event id>')",
"@odata.type": "#Microsoft.OutlookServices.Event",
"OtherResourceData": "<some other resource data>"
}
}
}
Microsoft.Graph.EventDeleted 事件
{
"id": "00d8a100-2e92-4bfa-86e1-0056dacd0fce",
"type": "Microsoft.Graph.EventDeleted",
"source": "/tenants/<tenant-id>/applications/<application-id>",
"subject": "Events/<event-id>",
"time": "2024-05-22T22:24:31.3062901Z",
"datacontenttype": "application/json",
"specversion": "1.0",
"data": {
"@odata.type": "#Microsoft.OutlookServices.Notification",
"Id": null,
"SubscriptionExpirationDateTime": "2024-06-22T23:56:30.1307708Z",
"ChangeType": "deleted",
"subscriptionId": "MTE1MTVlYTktMjVkZS00MjY3LWI1YzYtMjg0NzliZmRhYWQ2",
"resource": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Events('<event id>')",
"clientState": "<client state>",
"resourceData": {
"Id": "<event id>",
"@odata.etag": "<tag id>",
"@odata.id": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Events('<event id>')",
"@odata.type": "#Microsoft.OutlookServices.Event",
"OtherResourceData": "<some other resource data>"
}
}
}
Microsoft.Graph.ContactCreated 事件
{
"id": "00d8a100-2e92-4bfa-86e1-0056dacd0fce",
"type": "Microsoft.Graph.ContactCreated",
"source": "/tenants/<tenant-id>/applications/<application-id>",
"subject": "Contacts/<contact-id>",
"time": "2024-05-22T22:24:31.3062901Z",
"datacontenttype": "application/json",
"specversion": "1.0",
"data": {
"@odata.type": "#Microsoft.OutlookServices.Notification",
"Id": null,
"SubscriptionExpirationDateTime": "2024-06-22T23:56:30.1307708Z",
"ChangeType": "created",
"subscriptionId": "MTE1MTVlYTktMjVkZS00MjY3LWI1YzYtMjg0NzliZmRhYWQ2",
"resource": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Contacts('<contact id>')",
"clientState": "<client state>",
"resourceData": {
"Id": "<contact id>",
"@odata.etag": "<tag id>",
"@odata.id": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Contacts('<contact id>')",
"@odata.type": "#Microsoft.OutlookServices.Contact",
"OtherResourceData": "<some other resource data>"
}
}
}
Microsoft.Graph.ContactUpdated 事件
{
"id": "00d8a100-2e92-4bfa-86e1-0056dacd0fce",
"type": "Microsoft.Graph.ContactUpdated",
"source": "/tenants/<tenant-id>/applications/<application-id>",
"subject": "Contacts/<contact-id>",
"time": "2024-05-22T22:24:31.3062901Z",
"datacontenttype": "application/json",
"specversion": "1.0",
"data": {
"@odata.type": "#Microsoft.OutlookServices.Notification",
"Id": null,
"SubscriptionExpirationDateTime": "2024-06-22T23:56:30.1307708Z",
"ChangeType": "updated",
"subscriptionId": "MTE1MTVlYTktMjVkZS00MjY3LWI1YzYtMjg0NzliZmRhYWQ2",
"resource": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Contacts('<contact id>')",
"clientState": "<client state>",
"resourceData": {
"Id": "<contact id>",
"@odata.etag": "<tag id>",
"@odata.id": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Contacts('<contact id>')",
"@odata.type": "#Microsoft.OutlookServices.Contact",
"OtherResourceData": "<some other resource data>"
}
}
}
Microsoft.Graph.ContactDeleted 事件
{
"id": "00d8a100-2e92-4bfa-86e1-0056dacd0fce",
"type": "Microsoft.Graph.ContactDeleted",
"source": "/tenants/<tenant-id>/applications/<application-id>",
"subject": "Contacts/<contact-id>",
"time": "2024-05-22T22:24:31.3062901Z",
"datacontenttype": "application/json",
"specversion": "1.0",
"data": {
"@odata.type": "#Microsoft.OutlookServices.Notification",
"Id": null,
"SubscriptionExpirationDateTime": "2024-06-22T23:56:30.1307708Z",
"ChangeType": "deleted",
"subscriptionId": "MTE1MTVlYTktMjVkZS00MjY3LWI1YzYtMjg0NzliZmRhYWQ2",
"resource": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Contacts('<contact id>')",
"clientState": "<client state>",
"resourceData": {
"Id": "<contact id>",
"@odata.etag": "<tag id>",
"@odata.id": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Contacts('<contact id>')",
"@odata.type": "#Microsoft.OutlookServices.Contact",
"OtherResourceData": "<some other resource data>"
}
}
}
Microsoft.Graph.MessageCreated 事件
{
"id": "00d8a100-2e92-4bfa-86e1-0056dacd0fce",
"type": "Microsoft.Graph.MessageCreated",
"source": "/tenants/<tenant-id>/applications/<application-id>",
"subject": "Users/<user-id>/Messages/<message-id>",
"time": "2024-05-22T22:24:31.3062901Z",
"datacontenttype": "application/json",
"specversion": "1.0",
"data": {
"@odata.type": "#Microsoft.OutlookServices.Notification",
"Id": null,
"SubscriptionExpirationDateTime": "2024-06-22T23:56:30.1307708Z",
"ChangeType": "created",
"subscriptionId": "MTE1MTVlYTktMjVkZS00MjY3LWI1YzYtMjg0NzliZmRhYWQ2",
"resource": "Users/<user-id>/Messages/<message-id>",
"clientState": "<client state>",
"tenantId":"<tenant-id>",
"resourceData": {
"Id": "<message id>",
"@odata.etag": "<tag id>",
"@odata.id": "Users/<user-id>/Messages/<message-id>",
"@odata.type": "#Microsoft.OutlookServices.Message",
"OtherResourceData": "<some other resource data>"
}
}
}
Microsoft.Graph.MessageUpdated 事件
{
"id": "00d8a100-2e92-4bfa-86e1-0056dacd0fce",
"type": "Microsoft.Graph.MessageUpdated",
"source": "/tenants/<tenant-id>/applications/<application-id>",
"subject": "Messages/<message-id>",
"time": "2024-05-22T22:24:31.3062901Z",
"datacontenttype": "application/json",
"specversion": "1.0",
"data": {
"@odata.type": "#Microsoft.OutlookServices.Notification",
"Id": null,
"SubscriptionExpirationDateTime": "2024-06-22T23:56:30.1307708Z",
"ChangeType": "updated",
"subscriptionId": "MTE1MTVlYTktMjVkZS00MjY3LWI1YzYtMjg0NzliZmRhYWQ2",
"resource": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Messages('<message id>')",
"clientState": "<client state>",
"resourceData": {
"Id": "<message id>",
"@odata.etag": "<tag id>",
"@odata.id": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Messages('<message id>')",
"@odata.type": "#Microsoft.OutlookServices.Message",
"OtherResourceData": "<some other resource data>"
}
}
}
Microsoft.Graph.MessageDeleted 事件
{
"id": "00d8a100-2e92-4bfa-86e1-0056dacd0fce",
"type": "Microsoft.Graph.MessageDeleted",
"source": "/tenants/<tenant-id>/applications/<application-id>",
"subject": "Message/<message-id>",
"time": "2024-05-22T22:24:31.3062901Z",
"datacontenttype": "application/json",
"specversion": "1.0",
"data": {
"@odata.type": "#Microsoft.OutlookServices.Notification",
"Id": null,
"SubscriptionExpirationDateTime": "2024-06-22T23:56:30.1307708Z",
"ChangeType": "deleted",
"subscriptionId": "MTE1MTVlYTktMjVkZS00MjY3LWI1YzYtMjg0NzliZmRhYWQ2",
"resource": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Messages('<message id>')",
"clientState": "<client state>",
"resourceData": {
"Id": "<message id>",
"@odata.etag": "<tag id>",
"@odata.id": "https://outlook.office365.com/api/beta/Users('userId@tenantId')/Messages('<message id>')",
"@odata.type": "#Microsoft.OutlookServices.Message",
"OtherResourceData": "<some other resource data>"
}
}
}
事件属性
事件具有以下顶级数据:
属性 | 类型 | 说明 |
---|---|---|
source |
字符串 | 租户事件源。 此字段不可写入。 Microsoft Graph API 提供此值。 |
subject |
string | 事件主题的发布者定义路径。 |
type |
string | 此事件源的事件类型之一。 |
time |
字符串 | 事件的生成时间,基于提供程序的 UTC 时间 |
id |
字符串 | 事件的唯一标识符。 |
data |
object | 提供有关资源状态更改的数据的事件有效负载。 |
specversion |
字符串 | CloudEvents 架构规范版本。 |
数据对象具有以下属性:
属性 | 类型 | 说明 |
---|---|---|
changeType |
字符串 | 资源状态更改的类型。 |
resource |
字符串 | 针对其引发事件的资源标识符。 |
tenantId |
字符串 | 保留用户或联系人的组织 ID。 |
clientState |
字符串 | 创建 Graph API 订阅时由用户提供的机密。 |
@odata.type |
字符串 | Graph API 更改类型。 |
@odata.id |
字符串 | 针对其引发事件的 Graph API 资源标识符。 |
id |
字符串 | 针对其引发事件的资源标识符。 |
organizationId |
字符串 | Outlook 租户标识符。 |
eventTime |
string | 资源状态发生的时间。 |
sequenceNumber |
string | 序列号。 |
subscriptionExpirationDateTime |
string | Graph API 订阅过期时间,采用变更请求 (RFC) 3339 格式。 |
subscriptionId |
string | Graph API 订阅标识符。 |
tenantId |
字符串 | Outlook 租户标识符。 |
otherResourceData |
string | 表示事件中可能包含的一个或多个动态属性的占位符。 |