jamesiarmes / php-ews

PHP Exchange Web Services
http://jamesarmes.com/php-ews/
MIT License
566 stars 304 forks source link

restart autodiscover process when RedirectAddr is found #560

Open isha1111 opened 5 years ago

isha1111 commented 5 years ago

In the hybrid environment, this library was not able to successfully perform autodiscover process. In this case we have to follow the RedirectAddr.

I have followed Microsoft documentation on what to do if RedirectAddr is found.

Here is the link to Microsoft documentation - https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/handling-autodiscover-error-messages#restarting-autodiscover-with-a-new-email-address

When you get a new email address in an Autodiscover redirect response, first verify that the new email address that was provided in the redirect error response is not the same address that you sent in the request that resulted in the error. If it is, you should not restart Autodiscover and instead consider the URL that generated the response to be invalid.

If the new email address is different, discard your existing list of potential Autodiscover endpoint URLs and generate a new list based on the new email address.