Reputation: 450
I am trying to get the room details from Exchange using EWS API.
Here is the example given for getting room list.
So as per the code I am trying to get the room details like location, city, state etc., but with code example's code block, I am only getting Id, MailboxType, Name & RoutingType
.
Code snippet I have tried:
// Initialize service object here
EmailAddressCollection myRoomLists = service.GetRoomLists();
foreach (EmailAddress address in myRoomLists)
{
EmailAddress myRoomList = address.Address;
Console.WriteLine("Email Address: {0}", address.Address);
}
Really appreciate if some can help me in getting the room property (Location, City, State etc.) with Exchange API in C#?
Upvotes: 2
Views: 2545
Reputation: 22032
The RoomList operation will only return the EmailAddresses of the Room Mailboxes in the list. To get further information on these you will need to use an operation like ResolveName and return the ContactInformation eg
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 is not a property that is exposed by EWS so you need to use a workaround to get it https://social.technet.microsoft.com/Forums/office/en-US/9eef45a5-dd1d-4912-9beb-bded7b40cb9e/ews-managed-api-using-c?forum=exchangesvrdevelopment
Cheers Glen
Upvotes: 3