GetServerTimeZonesType class
Exchange Server 2013
The GetServerTimeZonesType class represents a request to retrieve time zone definitions from the Exchange Server.
Namespace: ExchangeWebServices
Assembly: EWS (in EWS.dll)
The following code example shows you how to retrieve complete time zone definitions for the Eastern Standard Time time zone and the Pacific Standard Time time zone.
static void GetTZDefinition(ExchangeServiceBinding esb) { // Form the request. GetServerTimeZonesType gstzRequest = new GetServerTimeZonesType(); // Identify the time zone definitions to retrieve. gstzRequest.Ids = new string[] { "Eastern Standard Time", "Pacific Standard Time" }; // Specify that complete time zone definitions are requested. gstzRequest.ReturnFullTimeZoneData = true; gstzRequest.ReturnFullTimeZoneDataSpecified = true; try { // Send the request and get the response. GetServerTimeZonesResponseType gstzResponse = esb.GetServerTimeZones(gstzRequest); GetServerTimeZonesResponseMessageType responseMsg = gstzResponse.ResponseMessages.Items[0] as GetServerTimeZonesResponseMessageType; // Iterate through the time zone definitions. if (responseMsg.ResponseClass == ResponseClassType.Success) { foreach (TimeZoneDefinitionType tzd in responseMsg.TimeZoneDefinitions.TimeZoneDefinition) { Console.WriteLine("Time Zone name: " + tzd.Name); Console.WriteLine("Time Zone id: " + tzd.Id); Console.WriteLine(""); } } else { throw new Exception("GetServerTimeZones() failed."); } catch (Exception e) { Console.WriteLine(e.Message); } }
Show: