问题描述
在使用 EWS Managed API 2.0 和 Exchange Server 2007 SP3 时,我遇到了一个奇怪的问题.
There is a weird problem I'm facing when working with EWS Managed API 2.0 with Exchange Server 2007 SP3.
当我创建一个约会并保存它时,我使用以下代码获取它的 ID:
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);
}
当我想访问其中一个冲突会议的 ID 时,我发现它与我在本地数据库中拥有的 ID 不同,尽管所有其他信息都相同.我仍然可以使用我的 ID 绑定到约会,但问题是同一个会议现在有 2 个不同的 ID.为什么 EWS 不为约会存储唯一 ID 为什么和 (appointment.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.
推荐答案
Appointment 本身没有不改变的唯一 id,但约会有属性 IcalUid(我认为它的唯一日历项 id):
Appointment itself doesn't have unique id which doesnt change, but appointment has property ICalUid (i think its Unique calendar item id):
appointment.ICalUid;
这真的是独一无二的,并且不会改变,然后就我测试而言,会议会更新..我为一个人生成了 1000 次会议,并且所有 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 :)
这篇关于EWS:Appoitnment Item.Id.UniqueId 不是常数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!