EWS: Appoitnment Item.Id.UniqueId is not permanent

There is a strange problem that I encounter when working with EWS Managed API 2.0 with Exchange Server 2007 Service Pack 3 (SP3).

When I create a meeting and I save it, I get its identifier using the following code:

appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy); appointment.Id.UniqueId; 

and I store it in a local database, so I can use it later to update the meeting or cancel it.

Later, when I want to get conflicting collections, 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 collections, I find it different than the identifier that I have in my local database, although all the other data is the same. I can still use my ID to bind to the destination, but the problem is that at the same meeting there are now two different identifiers. Why does EWS not store a unique identifier for meetings, why and (destination .Id.UniqueId) is not permanent?

I did not find a clear solution to this problem.

+4
source share
3 answers

The assignment itself does not have a unique identifier that does not change, but the assignment has the ICalUid property (I think its unique identifier for the calendar element):

 appointment.ICalUid; 

which is truly unique and does not change, the collection is updated until I tested it. I created 1000 appointments for one person, and all ICalUid were unique. Try it, it helped me :)

+4
source

This is actually a very common problem faced by those using the EWS Managed API.

For some reason (I don't know why), the unique identifier changes when the destination is moved to another folder.
You can find your question and your answer in my post here:
Web Services Exchange: Why is ItemId Not a Constant? [Continued]

+3
source

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

0
source

Source: https://habr.com/ru/post/1484584/


All Articles