如何使用Microsoft Graph API获取建议时间?

时间:2018-03-06 22:40:00

标签: outlook microsoft-graph

当对方拒绝会议并提议新的时间。在Outlook中,您可以看到建议的时间。

enter image description here

现在我正在尝试使用Microsoft Graph API来获得建议的时间。

例如,原始会议日期为 2018-03-08 ,另一人拒绝并建议新的日期 2018-03-12

我试过

GET /beta/me/messages/{messageId}=?$expand=microsoft.graph.eventMessage/event

但是,我无法从返回的结果中找到建议的时间。我怎么才能得到它?感谢

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#users('576552d5-3bc0-42a6-a53d-bfceb405db23')/messages/$entity",
    "@odata.type": "#microsoft.graph.eventMessage",
    "@odata.etag": "W/\"DAAAABYAAACpTc/InBsuTYwTUBb+VIb4AADoRAyI\"",
    "id": "AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk-iwQZRbXMgkfKtmYhBwCpTc-InBsuTYwTUBb_VIb4AAAAAAEMAACpTc-InBsuTYwTUBb_VIb4AADnwc8mAAA=",
    "createdDateTime": "2018-03-06T22:29:10Z",
    "lastModifiedDateTime": "2018-03-06T22:29:11Z",
    "changeKey": "DAAAABYAAACpTc/InBsuTYwTUBb+VIb4AADoRAyI",
    "categories": [],
    "receivedDateTime": "2018-03-06T22:29:11Z",
    "sentDateTime": "2018-03-06T22:29:05Z",
    "hasAttachments": false,
    "internetMessageId": "<MWHPR15MB18399806CC97C61817C9A2B18BD90@MWHPR15MB1839.namprd15.prod.outlook.com>",
    "subject": "New Time Proposed: Test",
    "bodyPreview": "",
    "importance": "normal",
    "parentFolderId": "AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgAuAAAAAACUbnk-iwQZRbXMgkfKtmYhAQCpTc-InBsuTYwTUBb_VIb4AAAAAAEMAAA=",
    "conversationId": "AAQkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgAQAOnuCMgoRLdGs-1scw6i7EU=",
    "conversationIndex": "AdO1mnWL6e4IyChEt0az/WxzDqLsRQAABO5D",
    "isDeliveryReceiptRequested": null,
    "isReadReceiptRequested": false,
    "isRead": false,
    "isDraft": false,
    "webLink": "https://outlook.office365.com/owa/?ItemID=AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk%2FiwQZRbXMgkfKtmYhBwCpTc%2FInBsuTYwTUBb%2BVIb4AAAAAAEMAACpTc%2FInBsuTYwTUBb%2BVIb4AADnwc8mAAA%3D&exvsurl=1&viewmodel=ReadMessageItem",
    "inferenceClassification": "focused",
    "unsubscribeData": [],
    "unsubscribeEnabled": false,
    "meetingMessageType": "meetingDeclined",
    "type": "singleInstance",
    "isOutOfDate": false,
    "isAllDay": false,
    "isDelegated": false,
    "body": {
        "contentType": "html",
        "content": "Hi"
    },
    "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": "2018-03-08T04:00:00.0000000",
        "timeZone": "UTC"
    },
    "endDateTime": {
        "dateTime": "2018-03-08T05:00:00.0000000",
        "timeZone": "UTC"
    },
    "location": {
        "displayName": "Test",
        "locationType": "default",
        "uniqueIdType": "unknown"
    },
    "recurrence": null,
    "event@odata.context": "https://graph.microsoft.com/beta/$metadata#users('576552d5-3bc0-42a6-a53d-bfceb405db23')/messages('AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk-iwQZRbXMgkfKtmYhBwCpTc-InBsuTYwTUBb_VIb4AAAAAAEMAACpTc-InBsuTYwTUBb_VIb4AADnwc8mAAA%3D')/microsoft.graph.eventMessage/event/$entity",
    "event": {
        "@odata.etag": "W/\"qU3PyJwbLk2ME1AW/lSG+AAA6EQMeA==\"",
        "id": "AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk-iwQZRbXMgkfKtmYhBwCpTc-InBsuTYwTUBb_VIb4AAAAAAENAACpTc-InBsuTYwTUBb_VIb4AADnwkmiAAA=",
        "createdDateTime": "2018-03-06T22:28:32.3852279Z",
        "lastModifiedDateTime": "2018-03-06T22:29:11.4604154Z",
        "changeKey": "qU3PyJwbLk2ME1AW/lSG+AAA6EQMeA==",
        "categories": [],
        "originalStartTimeZone": "Pacific Standard Time",
        "originalEndTimeZone": "Pacific Standard Time",
        "iCalUId": "040000008200E00074C5B7101A82E0080000000000000000000000000000000000000000310000007643616C2D5569640100000033324633333433392D433744452D344338362D393046452D44424639314131363444323900",
        "reminderMinutesBeforeStart": 15,
        "isReminderOn": true,
        "hasAttachments": false,
        "subject": "Test",
        "bodyPreview": "Test",
        "importance": "normal",
        "sensitivity": "normal",
        "isAllDay": false,
        "isCancelled": false,
        "isOrganizer": true,
        "responseRequested": true,
        "seriesMasterId": null,
        "showAs": "busy",
        "type": "singleInstance",
        "webLink": "https://outlook.office365.com/owa/?itemid=AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk%2FiwQZRbXMgkfKtmYhBwCpTc%2FInBsuTYwTUBb%2BVIb4AAAAAAENAACpTc%2FInBsuTYwTUBb%2BVIb4AADnwkmiAAA%3D&exvsurl=1&path=/calendar/item",
        "onlineMeetingUrl": null,
        "responseStatus": {
            "response": "organizer",
            "time": "0001-01-01T00:00:00Z"
        },
        "body": {
            "contentType": "html",
            "content": "Hi"
        },
        "start": {
            "dateTime": "2018-03-08T04:00:00.0000000",
            "timeZone": "UTC"
        },
        "end": {
            "dateTime": "2018-03-08T05:00:00.0000000",
            "timeZone": "UTC"
        },
        "location": {
            "displayName": "Test",
            "locationType": "default",
            "uniqueId": "Test",
            "uniqueIdType": "private"
        },
        "locations": [
            {
                "displayName": "Test",
                "locationType": "default",
                "uniqueId": "Test",
                "uniqueIdType": "private"
            }
        ],
        "recurrence": null,
        "attendees": [
            {
                "type": "required",
                "status": {
                    "response": "declined",
                    "time": "2018-03-06T22:29:05Z"
                },
                "emailAddress": {
                    "name": "Rose",
                    "address": "rose@example.com"
                }
            }
        ],
        "organizer": {
            "emailAddress": {
                "name": "Jack",
                "address": "jack@example.com"
            }
        }
    }
}

1 个答案:

答案 0 :(得分:0)

API不会直接公开此信息。相关实体没有定义显示此信息的字段。但是,数据显然存在,您只需要知道如何实现它。答案在于extended properties

基本上,由于Graph没有公开这些值,我们需要深入研究存储此数据的MAPI属性。在对Exchange服务器协议文档进行了一些挖掘之后,我找到了PidLidAppointmentProposedStartWholePidLidAppointmentProposedEndWhole。我们只需要将这些MAPI属性定义转换为Graph扩展属性语法。

从文档中,这些都在PSETID_Appointment命名空间中,它使用GUID {00062002-0000-0000-C000-000000000046}PidLidAppointmentProposedStartWhole使用id 0x8250,PidLidAppointmentProposedEndWhole使用id 0x8251。所以那些应该转化为:

  • PidLidAppointmentProposedStartWhole'SystemTime {00062002-0000-0000-C000-000000000046} Id 0x8250'
  • PidLidAppointmentProposedEndWhole'SystemTime {00062002-0000-0000-C000-000000000046} Id 0x8251'

如果按照Get singleValueLegacyExtendedProperty我们在$expand子句中使用它们,我们会得到类似的内容:

GET /me/mailfolders/inbox/messages?$expand=singleValueExtendedProperties($filter=id eq 'SystemTime {00062002-0000-0000-C000-000000000046} Id 0x8250' or id eq 'SystemTime {00062002-0000-0000-C000-000000000046} Id 0x8251')

响应看起来像这样(省略了其他属性):

{
    "subject": "New Time Proposed: Let's meet",
    "singleValueExtendedProperties": [
        {
            "id": "SystemTime {00062002-0000-0000-c000-000000000046} Id 0x8250",
            "value": "2018-03-20T20:00:00Z"
        },
        {
            "id": "SystemTime {00062002-0000-0000-c000-000000000046} Id 0x8251",
            "value": "2018-03-20T21:00:00Z"
        }
    ]
}