如何从我收到的电子邮件中知道事件 ID?

How to know event Id from the email I got?

我正在使用 Microsoft Graph 实现一个功能,可以接受其他人通过电子邮件发送给我的会议(活动)。但是,为此,我需要先知道事件 ID。我在 message doc.

中没有找到任何有用的信息

这是我收到的包含活动信息的邮件。事件 ID 是哪个值?谢谢

{
  "@odata.type": "#microsoft.graph.eventMessageRequest",
  "@odata.etag": "W/\"CwAAABYAAACpTc/InBsuTYwTUBb+VIb5AABxZpE6\"",
  "id": "AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk-iwQZRbXMgkfKtmYhBwCpTc-InBsuTYwTUBb_VIb4AAAAAAEMAACpTc-InBsuTYwTUBb_VIb4AABx3MA8AAA=",
  "createdDateTime": "2017-09-06T22:03:44Z",
  "lastModifiedDateTime": "2017-09-06T23:54:42Z",
  "changeKey": "CwAAABYAAACpTc/InBsuTYwTUBb+VIb4AABxZpE6",
  "categories": [],
  "receivedDateTime": "2017-09-06T22:03:46Z",
  "sentDateTime": "2017-09-06T22:02:14Z",
  "hasAttachments": true,
  "internetMessageId": "<CY1PR00MB0185E9373E8D4FF8A97C5675DF970@CY2PR00MB0185.namprd00.prod.outlook.com>",
  "subject": "Hello",
  "bodyPreview": "preview of the email",
  "importance": "normal",
  "parentFolderId": "AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgAuAAAAAACUbnk-iwQZRbXMgkfKtmYhAQCpTc-InBsuTYwTUBb_VIb4AAAAAAEMAAA=",
  "conversationId": "AAQkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgAQAHwtGwSJ6Egxl56psayEpP8=",
  "conversationIndex": "AdMnW7xOfC0bBInoSDGXnqmxrISk/wAAA0nA",
  "isDeliveryReceiptRequested": null,
  "isReadReceiptRequested": false,
  "isRead": true,
  "isDraft": false,
  "webLink": "https://outlook.office365.com/owa/?ItemID=AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk%2FiwQZRbXMgkfKtaYhBwCpTc%2FInBsuTYwTUBb%2BVIb4AAAAAAEMAACpTc%2FInBsuTYwTUBb%2BVIb4AABxMs5PAAA%3D&exvsurl=1&viewmodel=ReadMessageItem",
  "inferenceClassification": "focused",
  "unsubscribeData": [],
  "unsubscribeEnabled": false,
  "meetingMessageType": "meetingRequest",
  "type": "singleInstance",
  "isOutOfDate": false,
  "isAllDay": false,
  "isDelegated": false,
  "responseRequested": true,
  "body": {
    "contentType": "html",
    "content": "<html>a long email</html>\r\n"
  },
  "sender": {
    "emailAddress": {
      "name": "Rose",
      "address": "rose@example.com"
    }
  },
  "from": {
    "emailAddress": {
      "name": "Rose",
      "address": "rose@example.com"
    }
  },
  "toRecipients": [
    {
      "emailAddress": {
        "name": "Jack",
        "address": "jack@example.com"
      }
    }
  ],
  "ccRecipients": [],
  "bccRecipients": [],
  "replyTo": [],
  "mentionsPreview": null,
  "flag": {
    "flagStatus": "notFlagged"
  },
  "startDateTime": {
    "dateTime": "2017-09-11T18:00:00.0000000",
    "timeZone": "UTC"
  },
  "endDateTime": {
    "dateTime": "2017-09-11T19:00:00.0000000",
    "timeZone": "UTC"
  },
  "location": {
    "displayName": "TBD",
    "locationType": "default",
    "uniqueIdType": "unknown"
  },
  "recurrence": null,
  "previousLocation": null,
  "previousStartDateTime": null,
  "previousEndDateTime": null
}

更新:

我尝试了 GET https://graph.microsoft.com/v1.0/me/messages/aVeryLongMailId/event,它 returns 400 Bad Request

{
    "error": {
        "code": "BadRequest",
        "message": "Unsupported segment type. ODataQuery: users/576552d5-3bc0-42a6-a53d-bfceb405db23/messages/AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk-iwQZRbXMgkfKtmYhBwCpTc-InBsuTYwTUBb_VIb4AAAAAAEMAACpTc-InBsuTYwTUBb_VIb4AAB2sQVPAAA=/event",
        "innerError": {
            "request-id": "f7d265de-85cc-41a0-bea9-2282f76c29f5",
            "date": "2017-09-15T23:45:40"
        }
    }
}

那不是消息,而是 eventMessage。你应该有一个 /event 关系来获得你的事件。所以格式是:

GET /me/messages/{meeting-request-id}?$expand=microsoft.graph.eventMessage/event

其中 {meeting-request-id} 是事件消息的 ID。

此处的 $expand 参数将会议请求转换为正确的类型 (microsoft.graph.eventMessage) 以访问 event 属性,然后在响应中展开它.