The directory functionality in Exchange Web Services can be a little limited and so within Exchange 2010 without using LDAP to access Active Directory directly there is no direct way to access custom Resource properties on Meeting Rooms or where you want to access Custom Attributes. However using Custom MailTips is one way of working around this issue (although it means duplicating the information).
For example to Create a Custom Mail Tip for a mailbox you use
set-mailbox meetingRoom2 -MailTip "Expresso Machine"
Then in EWS you can use this to retrieve the MailTip
For example to Create a Custom Mail Tip for a mailbox you use
set-mailbox meetingRoom2 -MailTip "Expresso Machine"
Then in EWS you can use this to retrieve the MailTip
- GetMailTipsType gmType = new GetMailTipsType();
- gmType.MailTipsRequested = new MailTipTypes();
- gmType.MailTipsRequested = MailTipTypes.CustomMailTip;
- gmType.Recipients = new EmailAddressType[1];
- EmailAddressType rcip1 = new EmailAddressType();
- rcip1.EmailAddress = "MeetingRoom2@domain.com";
- gmType.Recipients[0] = rcip1;
- EmailAddressType sendAs = new EmailAddressType();
- sendAs.EmailAddress = "MeetingRoom2@domain.com";
- gmType.SendingAs = sendAs;
- GetMailTipsResponseMessageType gmResponse = esb.GetMailTips(gmType);
- if (gmResponse.ResponseClass == ResponseClassType.Success)
- {
- foreach (MailTipsResponseMessageType mtResp in gmResponse.ResponseMessages)
- {
- Console.WriteLine(mtResp.MailTips.RecipientAddress.EmailAddress);
- Console.WriteLine(mtResp.MailTips.CustomMailTip);
- }
- }