检索事件详细信息时展开 singleValueExtendedProperty 不起作用

2023-12-02

我正在尝试使用 Microsoft Graph 检索事件的自定义属性值。 自定义属性是由 Outlook Office.js 添加创建的

这是请求

/v1.0/me/events/{id}?$expand=singleValueExtendedProperties($filter=id eq 'String {00020329-0000-0000-C000-000000000046} Name myCusProp')

这会从 Graph 返回成功的响应,但不会返回singleValueExtendedProperty。但是,Outlook 加载项仍然能够从同一事件检索属性值。

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('{id}')/events/$entity",
  "@odata.etag": "W/\"SdXmMkSN8kCNtzTsQ4x1lwAD7sMWVg==\"",
  "id": "{id}",
  "createdDateTime": "2019-09-30T10:12:34.110571Z",
  "lastModifiedDateTime": "2019-09-30T10:23:57.8338159Z",
  "changeKey": "SdXmMkSN8kCNtzTsQ4x1lwAD7sMWVg==",
  "categories": [],
  "originalStartTimeZone": "blah blah",
  "originalEndTimeZone": "blah blah Standard Time",
  "iCalUId": "040000008...EBBE4999DC5A61D31AC544",
  "reminderMinutesBeforeStart": 15,
  "isReminderOn": true,
  "hasAttachments": false,
  "subject": "WWW-002",
  "bodyPreview": "rt",
  "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=AQMkADU2OWFjYTFjLWNkMGYtNDdlNS1hNDIxLWIxYjlmY...DqyJu%2FWyzJk6m5v0MbSs7lwcASdXmMkSN8kCNtzTsQ4x1lwAAAgENA...AD7q52owAAAA%3D%3D&exvsurl=1&path=/calendar/item",
  "onlineMeetingUrl": null,
  "recurrence": null,
  "responseStatus": {
    "response": "organizer",
    "time": "0001-01-01T00:00:00Z"
  },
  "body": {
    "contentType": "html",
    "content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=us-ascii\">\r\n</head>\r\n<body>\r\n<div>rt</div>\r\n</body>\r\n</html>\r\n"
  },
  "start": {
    "dateTime": "2019-09-19T02:30:00.0000000",
    "timeZone": "UTC"
  },
  "end": {
    "dateTime": "2019-09-19T03:00:00.0000000",
    "timeZone": "UTC"
  },
  "location": {
    "displayName": "",
    "locationType": "default",
    "uniqueIdType": "unknown",
    "address": {},
    "coordinates": {}
  },
  "locations": [],
  "attendees": [],
  "organizer": {
    "emailAddress": {
      "name": "Info a",
      "address": "[email protected]"
    }
  }
}

----更新1-office.js代码-----

这是上面的office-js/outlook-add-in 代码参考。 可以在此处读取自定义属性值,不会出现任何问题。

const item = Office.context.mailbox.item;

item.loadCustomPropertiesAsync(asyncResult => {
    if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
        let customProps = asyncResult.value;
        customProps.set("myCusProp", "google.com");
        customProps.saveAsync(asyncResult => {
            if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
                item.loadCustomPropertiesAsync(asyncResult => {
                    const customProps = asyncResult.value;
                    const myCusProp = customProps.get("myCusProp");
                })
            }
        });
    }
}); 

From 文档:

id eq 'String {00020329-0000-0000-C000-000000000046} Name cecp-<add-in id from manifest>'

代替myCusProp use cecp-/* add-in id from manifest */

加载项 id 是清单中的 guid,此响应具有 JSON 格式的自定义属性。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

检索事件详细信息时展开 singleValueExtendedProperty 不起作用 的相关文章

随机推荐