Как проверить пользовательское свойство Outlook доступно через Microsoft Graph - PullRequest
1 голос
/ 27 сентября 2019

Я добавил пользовательское свойство в событие, используя надстройку 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"); 
            })
          }});}});

1 Ответ

1 голос
/ 27 сентября 2019

Вам не хватает параметра запроса $expand, и ваш идентификатор неверен.Правильный тип фотографии вызова выглядит следующим образом:

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')

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...