Dela via


Microsoft Outlook-händelser

Den här artikeln innehåller de egenskaper och scheman för Microsoft Outlook-händelser som Microsoft Graph-API:et publicerar. En introduktion till händelsescheman finns i CloudEvents-schema.

Tillgängliga händelsetyper

Händelsenamn beskrivning
Microsoft.Graph.EventCreated Utlöses när en händelse i Outlook skapas.
Microsoft.Graph.EventUpdated Utlöses när en händelse i Outlook uppdateras.
Microsoft.Graph.EventDeleted Utlöses när en händelse i Outlook tas bort.
Microsoft.Graph.ContactSkapas Utlöses när en kontakt i Outlook skapas.
Microsoft.Graph.ContactUpdated Utlöses när en kontakt i Outlook uppdateras.
Microsoft.Graph.ContactDeleted Utlöses när en kontakt i Outlook tas bort.
Microsoft.Graph.MessageCreated Utlöses när ett meddelande i Outlook skapas.
Microsoft.Graph.MessageUpdated Utlöses när ett meddelande i Outlook uppdateras.
Microsoft.Graph.MessageDeleted Utlöses när ett meddelande i Outlook tas bort.

Exempelhändelse

När en händelse utlöses skickar Event Grid-tjänsten data om händelsen till prenumererande mål. Det här avsnittet innehåller ett exempel på hur dessa data skulle se ut för varje Outlook-händelse.

Microsoft.Graph.EventSkapad händelse

{
	"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-händelse

{
	"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-händelse

{
	"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.ContactSkapa händelse

{
	"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-händelse

{
	"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-händelse

{
	"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.MessageSkapad händelse

{
	"id": "00d8a100-2e92-4bfa-86e1-0056dacd0fce",
	"type": "Microsoft.Graph.MessageCreated",
	"source": "/tenants/<tenant-id>/applications/<application-id>",
	"subject": "Users/<user-id>/Messages/<messaeg-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-händelse

{
	"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-händelse

{
	"id": "00d8a100-2e92-4bfa-86e1-0056dacd0fce",
	"type": "Microsoft.Graph.MessageDeleted",
	"source": "/tenants/<tenant-id>/applications/<application-id>",
	"subject": "Message/<messaeg-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>"
		}
	}
}

Händelseegenskaper

En händelse har följande data på den översta nivån:

Property Type Description
source sträng Klienthändelsekällan. Det här fältet kan inte skrivas. Microsoft Graph API tillhandahåller det här värdet.
subject sträng Utgivardefinierad sökväg till händelseobjektet.
type sträng En av händelsetyperna för den här händelsekällan.
time sträng Den tid då händelsen genereras baserat på leverantörens UTC-tid
id sträng Unik identifierare för händelsen.
data objekt Händelsenyttolast som innehåller data om resurstillståndsändringen.
specversion sträng CloudEvents schemaspecifikationsversion.

Dataobjektet har följande egenskaper:

Property Type Description
changeType sträng Typ av ändring av resurstillstånd.
resource sträng Resursidentifieraren som händelsen skapades för.
tenantId sträng Organisations-ID:t där användaren eller kontakten behålls.
clientState sträng En hemlighet som tillhandahålls av användaren när Graph API-prenumerationen skapas.
@odata.type sträng Ändringstypen för Graph API.
@odata.id sträng Graph API-resursidentifieraren som händelsen skapades för.
id sträng Resursidentifieraren som händelsen skapades för.
organizationId sträng Outlook-klientidentifieraren.
eventTime sträng Den tid då resurstillståndet inträffade.
sequenceNumber sträng Ett sekvensnummer.
subscriptionExpirationDateTime sträng Tiden i RFC-formatet (Request for Change) 3339 där Graph API-prenumerationen upphör att gälla.
subscriptionId sträng Graph API-prenumerationsidentifieraren.
tenantId sträng Outlook-klientidentifieraren.
otherResourceData sträng Platshållare som representerar en eller flera dynamiska egenskaper som kan ingå i händelsen.

Nästa steg