Microsoft Outlook 事件
本文提供 Microsoft Graph 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 |
string | 租用戶事件來源。 此欄位無法寫入。 Microsoft 圖形 API 提供此值。 |
subject |
string | 發行者定義事件主旨的路徑。 |
type |
string | 此事件來源的其中一種事件類型。 |
time |
string | 事件產生的時間,以提供者之 UTC 時間為準 |
id |
string | 事件的唯一識別碼。 |
data |
object | 提供關於資源狀態變更之資料的事件承載。 |
specversion |
string | CloudEvents 結構描述規格版本。 |
資料物件具有下列屬性:
屬性 | 類型 | 描述 |
---|---|---|
changeType |
string | 資源狀態變更的類型。 |
resource |
string | 引起事件的資源識別碼。 |
tenantId |
string | 保留使用者或聯絡人的組織識別碼。 |
clientState |
string | 使用者在建立圖形 API 訂用帳戶時所提供的祕密。 |
@odata.type |
string | 圖形 API 變更類型。 |
@odata.id |
string | 引起事件的圖形 API 資源識別碼。 |
id |
string | 引起事件的資源識別碼。 |
organizationId |
string | Outlook 租用戶識別碼。 |
eventTime |
字串 | 發生資源狀態的時間。 |
sequenceNumber |
字串 | 序號。 |
subscriptionExpirationDateTime |
字串 | 要求變更 (RFC) 3339 格式的時間,圖形 API 訂用帳戶到期。 |
subscriptionId |
字串 | 圖形 API 訂用帳戶識別碼。 |
tenantId |
string | Outlook 租用戶識別碼。 |
otherResourceData |
字串 | 佔位元,代表事件中可能包含的一或多個動態屬性。 |
下一步
- 如需 Azure 事件格線合作夥伴事件的簡介,請參閱合作夥伴事件概觀
- 如需如何訂閱 Microsoft Graph API 以接收 Outlook 事件的相關資訊,請參閱訂閱 Azure 圖形 API 事件。
- 如需 Azure 事件格線事件處理常式的相關資訊,請參閱事件處理常式。
- 如需建立 Azure Event Grid 訂用帳戶的詳細資訊,請參閱建立事件訂用帳戶和 Event Grid 訂用帳戶結構描述。
- 如需如何設定事件訂用帳戶以選取要傳遞之特定事件的相關資訊,請參閱事件篩選。 您也可參考篩選事件。