Skip to content

email.Move from inbox to public folder gives error #438

Description

@pascalgross

When trying to move a mail item from an user's inbox to a public folder, I get the following API error:

'Access to this API requires the following permissions: 'MailExport-Internal.Read.All,MailExport-Internal.Read.Shared,MailExport-Internal.ReadWrite.All,MailExport-Internal.ReadWrite.Shared'. However, the application only has the following permissions granted: 'full_access_as_app,Mail.ReadWrite,Mail.Read,Mail.Send'.";error_category="invalid_grant"

I'm unable to grant those internal permissions but the app has "full_access_as_app" but it doesn't seem to be sufficient.

My codes looks like this:

let token = this._token;
if (!token) {
  token = await this.getToken();
}

const ews = new ExchangeService();
ews.Url = new Uri('https://outlook.office365.com/EWS/Exchange.asmx');
ews.Credentials = new OAuthCredentials(token);
ews.ImpersonatedUserId = new ImpersonatedUserId(
  ConnectingIdType.PrincipalName,
  principalName
);

const email = await EmailMessage.Bind(ews, new ItemId(mailItemId));
await email.Move(new FolderId(folderId));

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions