Exchange 2013 API - 获取房间属性

时间:2015-10-09 07:13:16

标签: c# api exchange-server exchangewebservices

我正在尝试使用EWS API从Exchange获取房间详细信息。

Here是获取房间列表的示例。

所以根据代码,我试图获取房间详细信息,如位置,城市,州等,但使用代码示例的代码块,我只获得Id, MailboxType, Name & RoutingType

我尝试过的代码段:

// Initialize service object here

EmailAddressCollection myRoomLists = service.GetRoomLists();
foreach (EmailAddress address in myRoomLists)
{
     EmailAddress myRoomList = address.Address;
     Console.WriteLine("Email Address: {0}", address.Address);
}

真的很感激,如果有人可以帮我在C#中使用Exchange API获取房间属性(位置,城市,州等)吗?

1 个答案:

答案 0 :(得分:3)

RoomList操作只会返回列表中房间邮箱的EmailAddresses。要获得有关这些的更多信息,您需要使用ResolveName之类的操作并返回ContactInformation,例如

        EmailAddressCollection myRoomLists = service.GetRoomLists();
        foreach (EmailAddress address in myRoomLists)
        {
            EmailAddress myRoomList = address.Address;
            PropertySet AllProps = new PropertySet(BasePropertySet.FirstClassProperties);
            NameResolutionCollection ncCol = service.ResolveName(address.Address, ResolveNameSearchLocation.DirectoryOnly, true, AllProps);
            foreach (NameResolution nr in ncCol)
            {
                Console.WriteLine(nr.Contact.DisplayName);
                Console.WriteLine(nr.Contact.Notes);
            }
        }

Room Capacity不是EWS公开的属性,因此您需要使用变通方法来获取它https://social.technet.microsoft.com/Forums/office/en-US/9eef45a5-dd1d-4912-9beb-bded7b40cb9e/ews-managed-api-using-c?forum=exchangesvrdevelopment

干杯 格伦