I am using Microsoft Graph to implement a function that can accept the meeting (event) others sent to me through email. However, to do this, I need know the event Id first. I didn't find any useful info in the message doc.
This is the mail I got with event information. Which value is the event Id? Thanks
{
"@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": "[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:
I tried GET https://graph.microsoft.com/v1.0/me/messages/aVeryLongMailId/event
, it returns 400 Bad Request and
{
"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"
}
}
}
That isn't a message, it's an eventMessage. You should have an /event relationship that gets you the event. So the format would be:
Where
{meeting-request-id}
is the ID of the event message.The
$expand
parameter here casts the meeting request to the proper type (microsoft.graph.eventMessage
) to get access to theevent
property, then expands it in the response.