Hi,
I'm trying to create an appointment in 2 mailboxes and simulate the Auto Answer feature:
userA creates an appoitment with userB as RequiredAttendee and I want userB to automatically accept the appointment.
I have 2 solutions:
Solution 1:
I impersonate userA and create and appointment with the option CalendarItemCreateOrDeleteOperationType.SendToAllAndSaveCopy.
I then open the calendar of userB, locate the calendarEntry by CleanGlobalObjectId, programmatically accept the invitation, and finally delete the mail from the inbox.
This is working fine but I would prefer to make work solution 2:
Solution 2:
I create 2 separate appointments in the 2 calendars and link them with the GlobalObjectId and CleanGlobalObjectId values: I manage to create an appointment in calendar A and retrieve the GlobalObjectId.
When I create a new appointment in calendar 2 and set GlobalObjectId and CleanGlobalObjectId, I get no errors but when I read back the value, it is not the value I tried to set as if Exchange had ignored the value passed and created his own one.
I tried to set the value during creation or during update in vain.
Do you have a sample code that creates an appointment and set the GlobalObjectId ?
Example of creation:
List<ExtendedPropertyType> properties = new List<ExtendedPropertyType>(); properties.Add(CreateExtendedProperty("CleanGlobalObjectId", id, MapiPropertyTypeType.String)); <<--- tried with binary too properties.Add(CreateExtendedProperty("GlobalObjectId", id, MapiPropertyTypeType.String)); appointment.ExtendedProperty = properties.ToArray(); private ExtendedPropertyType CreateExtendedProperty(string name, string base64String, MapiPropertyTypeType type) { return new ExtendedPropertyType() { ExtendedFieldURI = new PathToExtendedFieldType() { PropertyName = name, PropertyType = type, PropertySetId = "6ED8DA90-450B-101B-98DA-00AA003F1305", PropertyId = 0x0023 }, Item = base64String }; }
Example of update:
string id = "BAAAAIIA4AB0xbcQGoLgCAAAAACpxe3c0IDOAQAAAAAAAAAAEAAAAAx/fxXSBOlFsIvn9fJnzmc="; byte[] bytes = System.Convert.FromBase64String(id); ExtendedPropertyDefinition epd = new ExtendedPropertyDefinition( new Guid("6ED8DA90-450B-101B-98DA-00AA003F1305"), 0x0023, MapiPropertyType.Binary); appointment.SetExtendedProperty(epd, bytes); appointment.Update(ConflictResolutionMode.AutoResolve);
-- Emmanuel Dreux