
我已尝试使用EWS DLL版本1.2和2.0,使用默认凭据或传入凭据.我注意到在最初发布之后,响应标题显示我们正在使用Exchange 2012 SP2,因此我尝试更新我的代码以使用该ExchangeVersion枚举值,但结果没有变化.
我已成功在此Exchange服务器上使用EWS来读取邮箱,但之前从未使用过房间.
C#
ExchangeService es = new ExchangeService(ExchangeVersion.Exchange2010); es.TraceFlags = TraceFlags.EwsResponse | TraceFlags.EwsRequest; es.TraceEnabled = true; es.UseDefaultCredentials = true; es.autodiscoverUrl("autodiscover@example.com"); //this collection is empty after processing EmailAddressCollection eac = es.GetRoomLists(); 来自Web服务请求/响应的XML跟踪
<Trace Tag="EwsRequest" TID="9" Time="2013-03-13 20:39:41Z" Version="14.03.0032.000"> <?xml version="1.0" enCoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:header> <t:RequestServerVersion Version="Exchange2010" /> </soap:header> <soap:Body> <m:GetRoomLists /> </soap:Body> </soap:Envelope></Trace><Trace Tag="EwsResponse" TID="9" Time="2013-03-13 20:39:41Z" Version="14.03.0032.000"> <?xml version="1.0" enCoding="utf-8"?> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:header> <h:ServerVersionInfo MajorVersion="14" MinorVersion="2" MajorBuildNumber="328" MinorBuildNumber="9" Version="Exchange2010_SP2" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> </s:header> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <GetRoomListsResponse ResponseClass="Success" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"> <ResponseCode>NoError</ResponseCode> <m:RoomLists xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" /> </GetRoomListsResponse> </s:Body> </s:Envelope></Trace>
GetRoomLists上的MSDN文档:http://msdn.microsoft.com/en-us/library/dd899416(v=exchg.140).aspx
解决方法 好吧,我找到了原因/解决方案.令人困惑的是,GetRoomLists不返回房间列表,而是返回房间列表或“房间列表”集合的列表.这些是包含房间列表的特殊类型的分发列表.如此处所述,http://social.msdn.microsoft.com/Forums/en-US/exchangesvrdevelopment/thread/4ff04c60-48c2-4a69-ab75-2383e73bfde2,您需要设置房间列表,或者需要查询AD并检查msExchRecipIEntdisplayType属性以跟踪房间.
此链接显示了如何将LDAP查询写入返回房间的示例:http://social.msdn.microsoft.com/Forums/en-US/exchangesvrdevelopment/thread/e2d10953-a8f9-459c-8a0e-f10c2e568b26
代码我放在一起寻找房间:
private List<string> GetConfRooms(string filter){ List<string> sRooms = new List<string>(); DirectoryEntry deDomain = System.DirectoryServices.ActiveDirectory.Domain.GetComputerDomain().GetDirectoryEntry(); DirectorySearcher dsRooms = new DirectorySearcher(deDomain); dsRooms.Filter = string.Format("(&(&(&(mailNickname={0}*)(objectcategory=person)(objectclass=user)(msExchRecipIEntdisplayType=7))))",filter); dsRooms.PropertIEsToload.Add("sn"); dsRooms.PropertIEsToload.Add("mail"); foreach (SearchResult sr in dsRooms.FindAll()) { sRooms.Add(sr.PropertIEs["mail"][0].ToString()); } return sRooms;} 总结 以上是内存溢出为你收集整理的c# – GetRoomLists成功但不返回任何数据全部内容,希望文章能够帮你解决c# – GetRoomLists成功但不返回任何数据所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)