0
votes

I used EWS API 2.0 to update the location and subject in an outlook meeting item. I can see both the location and subject reflects in the outlook calendar. However, when I pop open the appointment item, the location is blank, however, I can still see the updated subject.

Below is the code I used:

Appointment appointment = Appointment.Bind(_service, ConvertId(entryId));
 appointment.Location = location;
 appointment.Subject = "Server Update Subject";
 appointment.Update(ConflictResolutionMode.AutoResolve, SendInvitationsOrCancellationsMode.SendToNone); 

PS: I used outlook add-in (VSTO) to open my web application to find an available meeting room and update the meeting item.

As soon as the room (location) got updated on server side (via EWS), I can see the outlook calendar reflect the change immediately but the update does not show on the opened appointment item in outlook.

I need to close the appointment item in outlook and re-open the appointment item to see the update, but still, I can only see the updated subject, not location.

To see the updated location reflects there, I need to close Outlook and re-open it to see the location...

Any comments or direction for things to try will be great appreciated! Thank you :-)

1

1 Answers

0
votes

Finally figured this out, after many hours of research.

It is a known issue that Outlook doesn't update the changes made through EWS (or change from the server side) until you re-open the application and release all references to the object (before re-opening). So the solution would be to add Marshal.ReleaseComObject as below:

Marshal.ReleaseComObject(apptItem);

to release the object (same as close outlook application), then re-open the object using EntryId.

string eid = item.EntryID;
--- release the app object ---
var ns = application.GetNamespace("MAPI");// application.Session;// application.GetNamespace("MAPI");

Outlook.AppointmentItem appoinment = ns.GetItemFromID(eid) as Outlook.AppointmentItem;

I hope this solution help anyone who ran into the same issue as I do.