Hello,
I am attempting to write a method to find the Exchange Server version an Exchange Server I'm connecting to with EWS.
It is clear that reading the contents of a response XML to an EWS request contains this info, as described here.
I'm curious if I must test and error handle or if there's another "less invasive" method to find the Exchange version.
How do I find the version of an Exchange Server I am attempting to access with EWS so that I can set it for EWS managed API activity?
I am currently using the following, but I can't imagine this is the most efficient way?
foreach (ExchangeVersion exchver in Enum.GetValues(typeof(ExchangeVersion))) { //Console.WriteLine(exchver.ToString()); try { ExchangeService service = new ExchangeService(exchver); //Do stuff here } catch (Exception e) { Console.WriteLine("Server is not " + exchver +". Trying next ExchangeVersion."); } }
Any assistance is appreciated.
Thanks,
Matt