Jaa


GetServerTimeZonesType Class

The GetServerTimeZonesType class represents a request to retrieve time zone definitions from the Exchange Server.

Inheritance Hierarchy

System.Object
  ExchangeWebServices.BaseRequestType
    ExchangeWebServices.GetServerTimeZonesType

Namespace:  ExchangeWebServices
Assembly:  EWS (in EWS.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public Class GetServerTimeZonesType _
    Inherits BaseRequestType
'Usage
Dim instance As GetServerTimeZonesType
[SerializableAttribute]
public class GetServerTimeZonesType : BaseRequestType

Examples

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);
    }
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.