I have tried to use extended properties on appointments with EWS, but I can not seem to find the appointments again. The set property part is equal to the one shown in this question:
How to Update an Appointment from Exchange Web Service Managed API 2.0 in ASP.NET
When I try to retrieve the appointment, I have followed these examples:
http://msdn.microsoft.com/en-us/uc14trainingcourse_5l_topic3#_Toc254008129 http://msdn.microsoft.com/en-us/library/exchange/dd633697(v=exchg.80).aspx
But I never get any appointments returned when I make a lookup.
Here is the code for the lookup:
ItemView view = new ItemView(10);
// Get the GUID for the property set.
Guid MyPropertySetId = new Guid("{" + cGuid + "}");
// Create a definition for the extended property.
ExtendedPropertyDefinition extendedPropertyDefinition =
new ExtendedPropertyDefinition(MyPropertySetId, "AppointmentID", MapiPropertyType.String);
view.PropertySet =
new PropertySet(
BasePropertySet.IdOnly,
ItemSchema.Subject,
AppointmentSchema.Start,
AppointmentSchema.End, extendedPropertyDefinition);
SearchFilter filter = new SearchFilter.Exists(extendedPropertyDefinition);
FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, filter,
view);
Any help is greatly appreciated.
Edit: When I try to create the property like the documentation shows:
http://msdn.microsoft.com/en-us/library/exchange/dd633654(v=exchg.80).aspx
It fails because its a Guid im adding as property value. :-/
Edit again: Just tried getting all appointments for today, and getting the property from the appointment I just created, and it says the same as I stored, without the {}, so it must be somthing with the filter.
Edit once again* It has somthing to do with
ExtendedPropertyDefinition extendedProperty = new ExtendedPropertyDefinition(
if I use:
new ExtendedPropertyDefinition(
DefaultExtendedPropertySet.Appointment,
"AppointmentID",
MapiPropertyType.String);
It finds all the appointments with properties, but if I search for a specific one:
Guid MyPropertySetId = new Guid("{" + cGuid + "}");
ExtendedPropertyDefinition extendedProperty =
new ExtendedPropertyDefinition(
MyPropertySetId,
"AppointmentID",
MapiPropertyType.String);
Then nothing is found.