as some others have discuss this problem before (e.g., Exchange web services: why is ItemId not constant?), I want to talk about the solution, I have done what people have suggested by stamping the Guid as an extended property, For me this solution is kind of nice (although I do not know how to make it work with the occurrences) but only as long as the application works, once the application restarts the extended properties of the items disappear, so my problem now, is “How to stamp the extended property on the EWS item and make it constantly there?”
This is the code of updating the calendar items (appointments)
public void SetGuidForAppointement(Appointment appointment)
{
appointment.SetExtendedProperty((ExtendedPropertyDefinition)_appointementIdPropertyDefinition, Guid.NewGuid().ToString());
appointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToNone);
}
And these are the properties definition needed above.
_appointementIdPropertyDefinition = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Appointment, "AppointmentID", MapiPropertyType.String);
_propertyDefinitionBases = new PropertyDefinitionBase[] { _appointementIdPropertyDefinition, ItemSchema.ParentFolderId, AppointmentSchema.Start, AppointmentSchema.End,
AppointmentSchema.LegacyFreeBusyStatus, AppointmentSchema.Organizer };
PropertySet = new PropertySet(BasePropertySet.FirstClassProperties, _propertyDefinitionBases);
So if anyone has done this before could he/she provide me with an example that keeps the extended property stamped on the item even if the application exited.
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…