2017-02-27 53 views
1

我試圖通過EWS API 2.0去取房間列表,但得到列表0在EWS API沒有得到房間列表

這裏是我的示例代碼:

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; 

回答