2017-09-07 98 views
0

我正在使用Microsoft Graph实现可以接受其他人通过电子邮件向我发送的会议(活动)的功能。但是,要做到这一点,我需要先了解事件标识。我在message doc中找不到任何有用的信息。如何从我收到的电子邮件中知道事件ID?

这是我收到的有关活动信息的邮件。哪个值是事件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": "<[email protected]od.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": "[email protected]" 
    } 
    }, 
    "from": { 
    "emailAddress": { 
     "name": "Rose", 
     "address": "[email protected]" 
    } 
    }, 
    "toRecipients": [ 
    { 
     "emailAddress": { 
     "name": "Jack", 
     "address": "[email protected]" 
     } 
    } 
    ], 
    "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 
} 

UPDATE:

我试过GET https://graph.microsoft.com/v1.0/me/messages/aVeryLongMailId/event,则返回400错误请求

{ 
    "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" 
     } 
    } 
} 

回答

2

这不是一个消息,这是一个eventMessage。你应该有一个/事件关系,让你的事件。所以格式应该是:

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

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

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

+0

对不起,我没有得到它。你希望我运行'GET/me/messages/{meeting-request-id}/event',但我在哪里可以找到'meeting-request-id'? –

+0

这是您在原始帖子中显示的消息的“id”。这是会议请求(在用户的收件箱中)。 –

+0

我刚试过,它给了我一个400错误。我在我的问题中添加了结果。 –

相关问题