3

我使用加载项向事件添加了自定义属性office.js

我尝试使用该自定义属性的值, https://graph.microsoft.com/v1.0/me/events/AQMkADU2OWFjYTF..AAAA==?singleValueExtendedProperties($filter=id eq 'String 00020329-0000-0000-C000-000000000046 myCusPropId ')但它返回错误:

{
  "error": {
    "code": "ErrorInvalidProperty",
    "message": "PropertyId values may only be in one of the following formats: 'MapiPropertyType namespaceGuid Name propertyName', 'MapiPropertyType namespaceGuid Id propertyId' or 'MapiPropertyType propertyTag'.",
    "innerError": {
      "request-id": "c57cd272-2c10-4721-b48e-1c27117ea34f",
      "date": "2019-09-27T10:23:03"
    }
  }
}

我该如何找回myCusPropId

这是 office.js 代码

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"); 
            })
          }});}});
4

1 回答 1

3

您缺少$expand查询参数并且您的 id 格式错误。正确的通话照片类型如下所示:

GET /me/events/{id}?$expand=singleValueExtendedProperties($filter=id eq '{prop_id}')

注意?$expand=singleValueExtendedProperties而不是?singleValueExtendedProperties

对于属性本身,您缺少该Name部分:

String {00020329-0000-0000-C000-000000000046} Name myCusPropId

所以最终的 URI 将是:

https://graph.microsoft.com/v1.0/me/events/AQMkADU2OWFjYTF..AAAA==?$expand=singleValueExtendedProperties($filter=id eq 'String {00020329-0000-0000-C000-000000000046} Name myCusPropId')

于 2019-09-27T20:29:37.150 回答