-->

PHP EWS using Callback Token

2019-07-18 15:47发布

问题:

Has anyone had any luck authenticating for a EWS SOAP request from PHP using the EWS Callback token instead of a username / password? I have been looking at the PHP-EWS project that comes up when you search for this on google but it only supports username / password authentication as far as I can tell.

Here is an example on how to do what I want to do, but it uses C# not PHP and I can't figure out how to translate what's going on here into something I can use in PHP. http://msdn.microsoft.com/en-us/library/dn148008(v=office.15)

I'm working on an Outlook Mail app that will allow my users to save the current email they are viewing to our database linked to a specific client. I am actually rebuilding an old Outlook Add-in that was originally built using VB.net a few years ago. The new architecture to use for Outlook Add-ins allows you to build apps that run in Outlook on desktop, mobile, and OWA. Unfortunately the new architecture doesn't allow as much direct access to the mail items within the application itself. Instead, you are supposed to use the getCallbackTokenAsync method in the app to get a token that you pass along with a EWS url and Item ID to your web based backend so the backend can make a SOAP request directly to the Exchange server to get properties from a mail item such as attachments.

回答1:

We don't have a PHP example, but to make a proper request, first construct the body of the request (the SOAP EWS request itself), then set the authorization header to be "bearer" and put the token right after. It should look like this over the wire "Authorization: Bearer abcdef1234...=="

What is the exact problem you are having? Can you share the code you wrote to construct the web request?

Also, we have a dedicated forum for apps for office here: http://social.msdn.microsoft.com/Forums/office/en-US/home?forum=appsforoffice