0
votes

I'm working on an application where the user logs in to his Exchange account. To save the user some monotony, I want to implement so that the entire URL of the server the user belongs to doesn't have to be given.

E.g

mail.domain.com

would result in

https://mail.domain.com/EWS/Exchange.asmx 

However, I can't find if it is safe to asume that all possible URLs will end in "/EWS/Exchange.asmx". Is that so? Or do I have to try all the possible combinations I can come up with, to see if it works?

2

2 Answers

2
votes

You need to use autodiscover and retrieve the server name from the returned XML. See https://msdn.microsoft.com/en-us/library/cc463896%28v=exchg.80%29.aspx?f=255&MSPPError=-2147217396

You can play with autodiscover in Outlook - Ctrl + right click on the Outlook icon in the tray area, select "Test E-mail AutoConfiguration".

0
votes

As Jason pointed out, you can not know for certain that the EWS resides at /EWS/Exchange.asmx, so I ended up implementing the following:

  1. Convert the URL on the form mail.domain.com to https://mail.domain.com/EWS/Exchange.asmx
  2. Try this URL. If it doesn't work, try to Autodiscover.
  3. If this doesn't work either, notify the user and ask him to be more specific.