ews-javascript-api icon indicating copy to clipboard operation
ews-javascript-api copied to clipboard

office.js callbacktoken for ews write operations.

Open garrit-schroeder opened this issue 5 years ago • 2 comments

Hello and thanks in advance.

Is it possible to use the token returned by getCallbackTokenAsync() for write operations in the ews api?

My scenario is: I want to send the callbacktoken to a backendserver, which uses this token with the ews api to read the mail. Works great! Put after that i want to move the mail into another folder. That does not work. I get the error message: The requested web method is unavailable to this caller or application.

Is there a way i can use the users oauth token to make mailbox write operations via the ews api?

garrit-schroeder avatar Mar 21 '19 13:03 garrit-schroeder

function EWSService(oauth_token, ews_url) { this.service = new ews.ExchangeService(ews.ExchangeVersion.Exchange2013); this.service.Credentials = new ews.OAuthCredentials(oauth_token); this.service.Url = new ews.Uri(ews_url); }

EWSService.prototype.move_mail_to_junk = function (item_id) { var properties = new ews.PropertySet([ ews.BasePropertySet.IdOnly, ews.EmailMessageSchema.Subject, ews.EmailMessageSchema.ParentFolderId ]); this.service.MarkAsJunk([new ews.ItemId(item_id)], false, true); };

garrit-schroeder avatar Mar 21 '19 13:03 garrit-schroeder

the token that you are getting from getCallbackTokenAsync call may be restricted using specific methods in EWS API.

gautamsi avatar Mar 21 '19 17:03 gautamsi