EWS : Appoitnment Item.Id.UniqueId is not constant

好久不见. 提交于 2019-12-30 10:21:49

问题


There is a weird problem I'm facing when working with EWS Managed API 2.0 with Exchange Server 2007 SP3.

When I create an appointment and I save it, I get its ID using the following code :

appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);

appointment.Id.UniqueId;

and I store it in my local DB so I can later use it to update the meeting or cancel it.

Later when I want to retrieve the conflicting meetings I use the following code :

CalendarView view = new CalendarView(Start, End);
view.PropertySet = new PropertySet();
Folder rootfolder = Folder.Bind(service, WellKnownFolderName.Calendar);
//view.PropertySet.Add(AppointmentSchema.Resources);
view.PropertySet.Add(ItemSchema.Id);
view.PropertySet.Add(AppointmentSchema.Subject);
view.PropertySet.Add(AppointmentSchema.Start);
view.PropertySet.Add(AppointmentSchema.Duration);
view.PropertySet.Add(AppointmentSchema.End);
view.PropertySet.Add(AppointmentSchema.Organizer);
view.PropertySet.Add(AppointmentSchema.Id);
Mailbox mailbox = new Mailbox(Email);
FolderId id = new FolderId(WellKnownFolderName.Calendar, mailbox);
CalendarFolder folder = CalendarFolder.Bind(service, id);
FindItemsResults<Appointment> findResults = folder.FindAppointments(view);

//Iterating through the conflicting meetings returned by folder.FindAppointments
foreach (Appointment app in findResults.Items)
  {
     appts.Rows.Add(app.Subject, app.Start, app.End, app.Duration, app.Id.UniqueId);
  }

and when I want to access the ID of one of the conflicting meetings I find it different than the ID I have it in my local DB although all other information are the same. I still can use my ID to bind to the appointment, but the problem is that the same meeting now have 2 different IDs. Why EWS isn't storing a unique ID for appointments why and (appointment.Id.UniqueId)is not constant ?

I didn't find a clear solution for this problem.


回答1:


Appointment itself doesn't have unique id which doesnt change, but appointment has property ICalUid (i think its Unique calendar item id):

appointment.ICalUid;

which is really unique and doesn't change then meeting is updated as far as i tested.. i generated 1000 meetings for one person and all ICalUid's were unique. Try it, it helped for me :)




回答2:


This is Actually a very common problem faced by those who are using the EWS Managed API.
For some reason (I do not know why) the Unique ID changes when the appointment is moved to another folder.
You can find your question and your answer in my post here:
Exchange web services: why is ItemId not constant? [continued]




回答3:


Keep in mind that Outlook recreates appointments when it processes incoming calendar updates.



来源:https://stackoverflow.com/questions/16934908/ews-appoitnment-item-id-uniqueid-is-not-constant

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!