Giter Site home page Giter Site logo

Comments (10)

Garethp avatar Garethp commented on August 10, 2024

Thanks for contacting me. As it stands I don't have the ability to test out Office 365 myself, I don't have any accounts with which to develop, hence only being able to get as far as working with the Auth Token. Are there different permissions you can give the application itself? Note that this library is for EWS, the SOAP API, not the new REST API. I know that Office 365 supports EWS, but I'm not sure what permissions you need to grant the app when you register the application.

As for your other question, if you want to see the requests going in and out, try breakpoints in NTMLSoapClient::__doRequest(). It's done using Guzzle, so you should be able to see the requests in PSR7

from php-ews.

monkeyphysics avatar monkeyphysics commented on August 10, 2024

Thanks for your reply. I will look further into this tomorrow.
Must admit that my mind is pretty clouded by Microsoft's various API's, versions, products, etc. Their documentation truly is a maze (and stuffed with 404's while on it).

I've been following this step-by-step guide to see in what direction it goes, and this seems to be working:
https://dev.outlook.com/RestGettingStarted/Tutorial/php

I will follow up.

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

That would be their REST API. It's pretty new, and nice, but not what this library is supporting. This library is built for their Exchange Web Services, which is a SOAP API. It wraps around a WSDL file and communicates with Exchange through XML calls. The reason I built this is because my work needed to communicate with a local Exchange 2007/2010 server, and they don't support REST. The starting point for that seems to be here, but that uses their Managed API as reference, which is a library they built for C#. If you google "EWS" and your use case, you'll find articles from Microsoft that explain things in C# and in XML, such as this. There is zero support for PHP, and no examples for it, hence this library.

If you only need to work with Office 365, I'd suggest not using this library and using REST from the start. REST is a nice standard to work with, and as you can see there's PHP examples for it

from php-ews.

monkeyphysics avatar monkeyphysics commented on August 10, 2024

Thanks for your help and input so far. Our case was exactly the same: communicating with a local Exchange 2010 server. However, we recently migrated to Office365, and I was hoping to simply switch from API::withUsernameAndPassword to API::withCallbackToken and be done with it.

But apparently, that won't work.

I'll dive into using the REST API, and take it from there.

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

Sorry about that. Once I'm able to get started with Office365 at some point myself, I'll investigate the how and why it doesn't work

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

So I've finally been able to sign up for a dev account (I wasn't able to before), and I'll be testing this now and writing up some docs. In the mean time, I used the old way of doing it and it worked without a hitch, no OAuth2 involved. Here's what I used that worked

use jamesiarmes\PEWS\Mail\MailAPI as API;

$api = API::withUsernameAndPassword('https://outlook.office365.com', '[email protected]', 'myPasssword');

$items = $api->getMailItems();

What do you get when you try to use UsernameAndPassword for office365.com?

from php-ews.

monkeyphysics avatar monkeyphysics commented on August 10, 2024

Oh wow. I can't believe I did not even try that in the first place. It works!

Having seen the workingWithOffice365.php example, I jumped straight into the token-business.

Is there any reason to assume Microsoft will stop supporting the SOAP API for Office365 in the future?

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

Probably not, no. They're very big on backwards compatibility and seem to still be supporting it and releasing new features for it. I'm still working on getting OAuth with EWS going.

from php-ews.

monkeyphysics avatar monkeyphysics commented on August 10, 2024

Awesome. Let's hope this thread will help at least a few other lost souls in the future :)

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

I've also improved the documentation for EWS over OAuth, if that's the street you want to go down. Turns out you can't have granular permissions for it, so in your Azure AD app configuration, you need to get it the "Access mailboxes as the signed-in user via Exchange Web Services" permission for "Office 365 Exchange Online"

from php-ews.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.