Can token returned from mailbox.getCallbackTokenAsync perform write action on mail item RRS feed

  • Question

  • From this doc we can use getCallbackTokenAsync to get a token with which we can use it to call the Exchange Web Services in a third party system. The quote is "Gets a string that contains a token used to get an attachment or item from an Exchange Server." It does not specify any limitation on the "write" permission.

    Then, according to this doc, if we change the add-in permission to ReadWriteMailbox, we can "Read and write all properties of any item in the user's mailbox."

    In my add-in I have the permission level set to ReadWriteMailbox and I use the token returned from getCallbackTokenAsync to authenticate the exchange service. But when I tried writing custom properties to Exchange server, I got this error Microsoft.Exchange.WebServices.Data.ServiceResponseException: 'The requested web method is unavailable to this caller or application.'

    My code

    exchangeService.Credentials = new OAuthCredentials(authenticationResult.AccessToken);
    Guid PS_PUBLIC_STRINGS = new Guid("00020329-0000-0000-C000-000000000046");
    ExtendedPropertyDefinition extendedPropertyDefinition = new ExtendedPropertyDefinition(PS_PUBLIC_STRINGS, "cecp-a8e14732-37cf-4a46-b69f-2539f4059948", MapiPropertyType.String);
    var obj = new
     customProp: "cp"
    Email.SetExtendedProperty(extendedPropertyDefinition, JsonConvert.SerializeObject(obj));

    Saturday, November 3, 2018 9:22 AM