Compartir a través de


Updating Exchange Web Services Clients for Exchange 2007 SP2

Topic Last Modified: 2009-07-24

To take advantage of the new Exchange Web Services (EWS) functionality that Microsoft Exchange Server 2007 Service Pack 2 (SP2) provides, you must update clients to be compliant with the schema that is distributed with Exchange 2007 SP2.

Changes in Exchange 2007 SP2

In Exchange 2007 SP2, Exchange Web Services includes the ability to specify time zone when you create or update task items. In versions of Exchange earlier than Exchange 2007 SP2, it is not possible to specify time zone when creating or updating a task, which in some cases causes DateTime properties to be stored differently than you might expect. The TimeZoneContext SOAP header in Exchange 2007 SP2 allows you to set the time zone for tasks so that DateTime properties of tasks will always be stored as you expect.

Updating Clients for Exchange 2007 SP2

If your EWS client application does not create or update tasks, there is no benefit to upgrading the application to use proxy classes that are generated against the schemas that are distributed with Exchange 2007 SP2 instead of the Exchange 2007 SP1 schemas. A client application that uses proxy classes that are generated against the Exchange Server 2007 SP1 schemas will work in the same manner with Exchange Server 2007 SP2 as with Exchange 2007 SP1.

An EWS client application that is updated to use proxy classes that are generated against the schemas that are distributed with Exchange 2007 SP2 must specify Exchange2007_SP1 as the request version in the SOAP header. Otherwise, requests that are sent to a Client Access server are assumed to be from Exchange 2007 client applications, and are validated against the initial release version of the Exchange Web Services schemas.

Note

Specifying the most recent request version in the SOAP header of requests ensures that your application gets the latest bug fixes and most up-to-date EWS behavior. For example, the Exchange2007_SP1 schema has many significant improvements over the Exchange2007 schema. 

The following example shows how to set the version on the ExchangeServiceBinding to represent a valid request, and how to specify Eastern Standard Time as the time zone for the DateTime properties of tasks that are created or updated by using the ExchangeServiceBinding object.

ExchangeServiceBinding esb = new ExchangeServiceBinding(); 

//Specify the request version.
esb.RequestServerVersionValue = new RequestServerVersion();
esb.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2007_SP1;

//Specify the time zone for DateTime properties of tasks.
TimeZoneDefinitionType tzdt = new TimeZoneDefinitionType();
tzdt.Id = "Eastern Standard Time";
TimeZoneContextType tzct = new TimeZoneContextType();
tzct.TimeZoneDefinition = tzdt;
esb.TimeZoneContext = tzct;

The following XML shows the SOAP header that represents a valid request and specifies Eastern Standard Time as the time zone for the DateTime properties of tasks that are created or updated. This is the same XML that is created by the RequestServerVersionValue property and the TimeZoneContext property of the ExchangeServiceBinding object.

<soap:Header>
  <t:RequestServerVersion Version="Exchange2007_SP1"/>
  <t:TimeZoneContext>
    <t:TimeZoneDefinition Id="Eastern Standard Time"/>
  </t:TimeZoneContext>
</soap:Header>

Before you update clients for Exchange 2007 SP2, you must install Exchange 2007 SP2 on the computer that is running Exchange 2007 or Exchange 2007 SP1.

To update a client application for Exchange 2007 SP2

  1. Regenerate proxy classes by using the schema that is distributed with Exchange 2007 SP2. For information about how to generate proxy classes, see Creating a Proxy Reference by Using Visual Studio 2005 or Visual Studio 2008.

  2. Add the request versioning information to the ExchangeServiceBinding. For information about how to add the request versioning information, see Versioning Requests (Exchange Web Services).

  3. Add the time zone information to the ExchangeServiceBinding.

  4. Test the client application.