使用 Microsoft Graph API 获取更改通知Use the Microsoft Graph API to get change notifications

Microsoft Graph REST API 使用 Webhook 机制将更改通知传递到客户端。The Microsoft Graph REST API uses a webhook mechanism to deliver change notifications to clients. 客户端是一个 Web 服务,用于配置自身的 URL 以接收通知。A client is a web service that configures its own URL to receive notifications. 客户端应用使用通知在更改时更新其状态。Client apps use notifications to update their state upon changes. 有关详细信息(包括如何订阅和处理传入通知),请参阅设置用户数据更改的通知For more details, including how to subscribe to and handle incoming notifications, see Set up notifications for changes in user data.

使用 Microsoft Graph API,应用可以订阅以下资源的更改:Using the Microsoft Graph API, an app can subscribe to changes on the following resources:

权限Permissions

通常订阅操作需要拥有对资源的读取权限。例如,若要获取邮件通知,应用需要 Mail.Read 权限。创建订阅一文列出了各个资源类型所需的权限。下表列出了将 webhook 用于特定资源类型时应用可以请求的权限类型。In general, subscription operations require read permission to the resource. For example, to get notifications for messages, your app needs the Mail.Read permission. The create subscription article lists permissions needed for each resource type. The following table lists the types of permissions your app can request to use webhooks for specific resource types.

权限类型Permission type 支持的资源类型Supported resource types in v1.0
委派 - 工作或学校帐户Delegated - work or school account 警报联系人对话driveItem事件邮件用户alert, contact, conversation, driveItem, event, group, message, user
委派 - 个人 Microsoft 帐户Delegated - personal Microsoft account 联系人driveItem事件邮件contact, conversation, event, message
应用程序Application 警报联系人driveItem事件邮件用户alert, contact, driveItem, event, group, message, user

另请参阅See also