none
Determine if EWS are on-premise or cloud hosted RRS feed

  • Question

  • In my application the user enters a URL to their Exchange Web Services. Is there a way for me to determine whether this URL is pointing to an on-premise version or cloud hosted (Office365)? Is there a service I can call or information that I can get back from the server that can help me determine this?

    Thanks for the help!


    Wednesday, September 26, 2018 1:24 PM

All replies

  • Just give you an idea. I tried to written a simple sample with TraceFlags property of EWS by using AutodiscoverUrl. The code as below:

    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
                service.Credentials = new WebCredentials("test@outlook.com", "test");
                service.TraceEnabled = true;
                service.TraceFlags = TraceFlags.All;
                service.AutodiscoverUrl("test@outlook.com", RedirectionUrlValidationCallback);
                EmailMessage email = new EmailMessage(service);
                email.ToRecipients.Add("test@outlook.com");
                email.Subject = "HelloWorld";
                email.Body = new MessageBody("This is the first email I've sent by using the EWS Managed API");
                email.Send();

    After running the code, I found a <MicrosoftOnline>True</MicrosoftOnline> node in the printed message. Please see the following link about MicrosoftOnline:

    MicrosoftOnline

    Hopefully it helps you.

    Regards,

    Simon


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Wednesday, September 26, 2018 3:31 PM
  • Hi,

    Did you solved your problem? Any updates for this? If your issue is still exist then let us know about that, we will try to suggest you further solve the issue.

    Regards,

    Simon


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Friday, September 28, 2018 5:49 AM