"GetUserOofSettings"、"SetUserOofSettings"和"GetUserAvailability"的操作上的 Exchange Server 2010 SP1 架构不支持 Exchange 模拟


症状


尝试自动生成的代理代码基于 Microsoft Exchange Server 2010 Service Pack 1 (SP1) 架构。 在此情况下,下面的行是缺少在代理代码中:
[System.Web.Services.Protocols.SoapHeaderAttribute("ExchangeImpersonation")] 
因此,自动生成代理不支持 Exchange Impersonation.This 问题影响以下三种操作:
  • GetUserOofSettings
  • SetUserOofSettings
  • GetUserAvailability

解决方案


若要解决此问题,请安装以下更新汇总:
2579150 更新汇总 4 的 Exchange Server 2010 Service pack 1 的说明

解决方法


若要变通解决此问题,请使用 Microsoft Exchange Web 服务 (EWS) 托管 API 1.1 更改架构中生成的类。 若要执行此操作,请在代理代码中添加以下行:
[System.Web.Services.Protocols.SoapHeaderAttribute("ExchangeImpersonation")] 
下面是GetUserOofSettings操作的示例。原来的代码:
[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]));}
更改后的代码:
[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]));}

状态


Microsoft 已确认这是在“适用范围”部分中列出的 Microsoft 产品存在的问题。

更多信息


有关GetUserOofSettings操作的详细信息,请访问下面的 Microsoft 网站:有关SetUserOofSettings操作的详细信息,请访问下面的 Microsoft 网站:有关GetUserAvailability操作的详细信息,请访问下面的 Microsoft 网站:有关 Exchange 模拟的详细信息,请访问下面的 Microsoft 网站: