如何通过 Microsoft Graph 检查 Outlook 自定义属性 [英] How to check an Outlook custom property is available via Microsoft Graph

查看:17
本文介绍了如何通过 Microsoft Graph 检查 Outlook 自定义属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I added a custom property to an Event using an office.js add-in.

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

I tried to get that custom property's value using https://graph.microsoft.com/v1.0/me/events/AQMkADU2OWFjYTF..AAAA==?singleValueExtendedProperties($filter=id eq 'String 00020329-0000-0000-C000-000000000046 myCusPropId ') but it is return an error:

{
  "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 代码

here is office.js code

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

推荐答案

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

You're missing the $expand query param and your id is malformed. The correct call phototype looks like this:

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

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

对于属性本身,您缺少 Name 段:

For the property itself, you're missing the Name segment:

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

所以最终的 URI 将是:

So the final URI would be:

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

这篇关于如何通过 Microsoft Graph 检查 Outlook 自定义属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆