The following 'code dump' solved my problem (have a close look at the property DistinguishedPropertySetType.PublicStrings made a world of difference!!):
public List<ExtendedAppointmentData> GetExtendedPropertyData(string mailbox, DateTime startDate, DateTime endDate, string boardRoomID)
{
if (Convert.ToBoolean(ConfigurationManager.AppSettings["remotecertificatevalidation"]))
ServicePointManager.ServerCertificateValidationCallback =
delegate(Object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
return true;
};
ExchangeServiceBinding esb = new ExchangeServiceBinding();
esb.Url = ConfigurationManager.AppSettings["exchangeService2010"];
esb.Credentials = new NetworkCredential("test", "password", "domain.local");
List<ExtendedAppointmentData> tmp = new List<ExtendedAppointmentData>();
FindItemType findItemRequest = new FindItemType();
CalendarViewType calendarView = new CalendarViewType();
calendarView.StartDate = startDate;
calendarView.EndDate = endDate;
calendarView.MaxEntriesReturned = 100;
calendarView.MaxEntriesReturnedSpecified = true;
findItemRequest.Item = calendarView;
ItemResponseShapeType itemProperties = new ItemResponseShapeType();
itemProperties.BaseShape = DefaultShapeNamesType.AllProperties;
findItemRequest.ItemShape = itemProperties;
DistinguishedFolderIdType[] folderIDArray = new DistinguishedFolderIdType[1];
folderIDArray[0] = new DistinguishedFolderIdType();
folderIDArray[0].Id = DistinguishedFolderIdNameType.calendar;
folderIDArray[0].Mailbox = new EmailAddressType();
folderIDArray[0].Mailbox.EmailAddress = mailbox;
findItemRequest.ParentFolderIds = folderIDArray;
findItemRequest.Traversal = ItemQueryTraversalType.Shallow;
try
{
FindItemResponseType findItemResponse = esb.FindItem(findItemRequest);
ArrayOfResponseMessagesType responseMessages = findItemResponse.ResponseMessages;
ResponseMessageType[] rmta = responseMessages.Items;
int folderNumber = 0;
foreach (ResponseMessageType rmt in rmta)
{
FindItemResponseMessageType firmt = rmt as FindItemResponseMessageType;
if (firmt.RootFolder == null)
continue;
FindItemParentType fipt = firmt.RootFolder;
object obj = fipt.Item;
if (obj is ArrayOfRealItemsType)
{
ArrayOfRealItemsType items = (obj as ArrayOfRealItemsType);
if (items.Items == null)
folderNumber++;
else
{
foreach (ItemType it in items.Items)
{
if (it is CalendarItemType)
{
CalendarItemType cal = (CalendarItemType)it;
ExtendedPropertyType[] extendedProperties = GetExtendedProperties(cal.ItemId, esb);
if (extendedProperties != null)
tmp.Add(new ExtendedAppointmentData()
{
EndDate = cal.End.ToLocalTime(),
StartDate = cal.Start.ToLocalTime(),
EventID = extendedProperties[0].Item.ToString(),
AppointmentStatus = cal.LegacyFreeBusyStatus.ToString(),
BoardroomID = boardRoomID,
FreeBusyInfo = this.GetFreeBusyTimes2010(30, mailbox, startDate, endDate, esb)
});
}
}
folderNumber++;
}
}
}
return tmp;
}
catch
{
throw;
}
}
private ExtendedPropertyType[] GetExtendedProperties(ItemIdType itemID, ExchangeServiceBinding serviceBinding)
{
PathToExtendedFieldType pathClassification = new PathToExtendedFieldType();
pathClassification.DistinguishedPropertySetId = DistinguishedPropertySetType.PublicStrings;
pathClassification.DistinguishedPropertySetIdSpecified = true;
pathClassification.PropertyName = STR_Guid;
pathClassification.PropertyType = MapiPropertyTypeType.String;
GetItemType getExPropertiesRequest = new GetItemType();
ItemIdType iiItemId = new ItemIdType();
iiItemId = itemID;
ItemResponseShapeType getResponseShape = new ItemResponseShapeType();
getResponseShape.BaseShape = DefaultShapeNamesType.AllProperties;
getResponseShape.IncludeMimeContent = true;
getExPropertiesRequest.ItemShape = getResponseShape;
getExPropertiesRequest.ItemShape.AdditionalProperties = new BasePathToElementType[1];
getExPropertiesRequest.ItemShape.AdditionalProperties[0] = pathClassification;
getExPropertiesRequest.ItemIds = new ItemIdType[1];
getExPropertiesRequest.ItemIds[0] = iiItemId;
getExPropertiesRequest.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties;
GetItemResponseType giResponse = serviceBinding.GetItem(getExPropertiesRequest);
if (giResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
{
return null;
}
else
{
ItemInfoResponseMessageType rmResponseMessage = giResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType;
MessageType message = rmResponseMessage.Items.Items[0] as MessageType;
return (rmResponseMessage.Items.Items[0].ExtendedProperty);
}
}
Kind regards,