Symptoms
You try to auto-generate proxy code based on the Microsoft Exchange Server 2010 Service Pack 1 (SP1) schema. In this situation, the following line is missing in the proxy code:
[System.Web.Services.Protocols.SoapHeaderAttribute("ExchangeImpersonation")]
Therefore, the auto-generated proxies do not support Exchange Impersonation.
This issue affects the following three operations:-
GetUserOofSettings
-
SetUserOofSettings
-
GetUserAvailability
Resolution
To resolve this issue, install the following update rollup:
2579150 Description of Update Rollup 4 for Exchange Server 2010 Service Pack 1
Workaround
To work around this issue, use Microsoft Exchange Web Services (EWS) Managed API 1.1 to change the generated classes in the schema. To do this, add the following line in the proxy code:
[System.Web.Services.Protocols.SoapHeaderAttribute("ExchangeImpersonation")]
Below is a sample for the GetUserOofSettings operation.
Original code:[System.Web.Services.Protocols.SoapHeaderAttribute("ServerVersionInfoValue", Direction = System.Web.Services.Protocols.SoapHeaderDirection.Out)]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/exchange/services/2006/messages/GetUserOofSettings", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)] [return: System.Xml.Serialization.XmlElementAttribute("GetUserOofSettingsResponse", Namespace = "http://schemas.microsoft.com/exchange/services/2006/messages")] public GetUserOofSettingsResponse GetUserOofSettings([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://schemas.microsoft.com/exchange/services/2006/messages")] GetUserOofSettingsRequest GetUserOofSettingsRequest) { object[] results = this.Invoke("GetUserOofSettings", new object[] { GetUserOofSettingsRequest}); return ((GetUserOofSettingsResponse)(results[0])); }
Changed code:
[System.Web.Services.Protocols.SoapHeaderAttribute("ServerVersionInfoValue", Direction = System.Web.Services.Protocols.SoapHeaderDirection.Out)]
[System.Web.Services.Protocols.SoapHeaderAttribute("ExchangeImpersonation")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/exchange/services/2006/messages/GetUserOofSettings", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)] [return: System.Xml.Serialization.XmlElementAttribute("GetUserOofSettingsResponse", Namespace = "http://schemas.microsoft.com/exchange/services/2006/messages")] public GetUserOofSettingsResponse GetUserOofSettings([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://schemas.microsoft.com/exchange/services/2006/messages")] GetUserOofSettingsRequest GetUserOofSettingsRequest) { object[] results = this.Invoke("GetUserOofSettings", new object[] { GetUserOofSettingsRequest}); return ((GetUserOofSettingsResponse)(results[0])); }
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
More Information
For more information about the GetUserOofSettings operation, visit the following Microsoft website:
General information about the GetUserOofSettings operationFor more information about the SetUserOofSettings operation, visit the following Microsoft website:
General information about the SetUserOofSettings operationFor more information about the GetUserAvailability operation, visit the following Microsoft website:
General information about the GetUserAvailability operationFor more information about Exchange Impersonation, visit the following Microsoft website: