3

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

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

How do I retrieve myCusPropId?

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"); 
            })
          }});}});
Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
DevÁsith
  • 1,072
  • 12
  • 38
  • It should be: `($filter=id eq 'String 00020329-0000-0000-C000-000000000046 Name myCusPropId')` Please note `Name` keyword before name of your property. Also, avoid extra spaces like you had in `myCusPropId '` – Ivan Franjic Sep 27 '19 at 14:48
  • @Ivan Franjic . i followed the way. i ran into this https://stackoverflow.com/questions/58166439/singlevalueextendedproperties-property-is-missing-when-expanding-outlook-event-i – DevÁsith Sep 30 '19 at 10:58
  • Try `https://graph.microsoft.com/v1.0/me/events/AQMkADU2OWFjYTF..AAAA==?$expand=singleValueExtendedProperties($filter=PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name myCusPropId')`. filter=PropertyId instead of id. – Outlook Add-ins Team - MSFT Oct 08 '19 at 06:03
  • tried this `https://graph.microsoft.com/v1.0/me/events/AQMkADU2OWFjYTF..AAAA==?$expand=singleValueExtendedProperties($filter=PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name myCusPropId'` and it gave bad request `{ "error": { "code": "BadRequest", "message": "Parsing Select and Expand failed.", "innerError": { "request-id": "dd23f71e-9ab4-4137-9a3a-1d01b647f6fc", "date": "2019-10-08T06:21:21" } } }` – DevÁsith Oct 08 '19 at 13:14

1 Answers1

3

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

Note the ?$expand=singleValueExtendedProperties rather than ?singleValueExtendedProperties.

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

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

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} Name myCusPropId')

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
  • I just tried this way but the response does not have custom property details. i created a new question for that https://stackoverflow.com/questions/58166439/singlevalueextendedproperties-property-is-missing-when-expanding-outlook-event-i – DevÁsith Sep 30 '19 at 11:00
  • is this 00020329-0000-0000-C000-000000000046 guid is correct ? – DevÁsith Sep 30 '19 at 14:10
  • Yes. Please add the code you're using to add the data via Office.js. – Marc LaFleur Sep 30 '19 at 14:33