我试图通过EWS api 2.0获取房间列表,但获取列表0。
这是我的示例代码:
var RoomList = new List<RoomListData>();
List<string> userLists = new List<string>();
ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013);
service.Credentials = new NetworkCredential("username", "password");
service.TraceEnabled = true;
service.TraceFlags = TraceFlags.All;
ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
service.Url = new Uri("**************/ews/exchange.asmx");
EmailAddressCollection myRoomLists = service.GetRoomLists();
//Display the room lists.
foreach (EmailAddress address in myRoomLists)
{
RoomList.Add(new RoomListData()
{
Address = address.Address,
Id = address.Id,
MailboxType = address.MailboxType,
Name = address.Name,
RoutingType = address.RoutingType,
});
}
response.RoomList = RoomList;
答案 0 :(得分:2)
在Exchange中,默认情况下没有配置空间列表,您需要使用New-DistributionGroup -RoomList switch https://technet.microsoft.com/en-us/library/aa998856(v=exchg.160).aspx创建RoomList。人们常常将您在GAL中看到的AddressBook视图(EG All Rooms)与RoomLists混淆,这些并不是同一件事。