EWS - 在预约的情况下,获取所有者的预约副本

时间:2016-07-08 16:22:31

标签: c# exchangewebservices

鉴于在EWS中有任命,是否可以获得所有者的副本?

例如,如果我以user1登录,我有user1user2创建的约会副本,我有假冒版权,我想要编辑user2的约会副本,如何获取user2的副本?

1 个答案:

答案 0 :(得分:2)

您可以使用会议邀请/更新和约会对象上设置的PidLidCleanGlobalObjectId https://msdn.microsoft.com/en-us/library/office/cc839502.aspx来在参加者或Orgainizer邮箱中搜索会议,例如

Appointment newAppointment = new Appointment(service);
newAppointment.Subject = "Test Subject";        
newAppointment.Start = new DateTime(2016, 08, 27, 17, 00, 0);
newAppointment.StartTimeZone = TimeZoneInfo.Local;
newAppointment.EndTimeZone = TimeZoneInfo.Local;
newAppointment.End = newAppointment.Start.AddMinutes(30);
newAppointment.Save();
newAppointment.Body = new MessageBody(Microsoft.Exchange.WebServices.Data.BodyType.Text, "test");
newAppointment.RequiredAttendees.Add("attendee@domain.com");
newAppointment.Update(ConflictResolutionMode.AlwaysOverwrite ,SendInvitationsOrCancellationsMode.SendOnlyToAll);
ExtendedPropertyDefinition CleanGlobalObjectId = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Meeting, 0x23, MapiPropertyType.Binary);
PropertySet psPropSet = new PropertySet(BasePropertySet.FirstClassProperties);
psPropSet.Add(CleanGlobalObjectId);
newAppointment.Load(psPropSet);
object CalIdVal = null;
newAppointment.TryGetProperty(CleanGlobalObjectId, out CalIdVal);
Folder AtndCalendar = Folder.Bind(service, new FolderId(WellKnownFolderName.Calendar,"attendee@domain.com"));
SearchFilter sfSearchFilter = new SearchFilter.IsEqualTo(CleanGlobalObjectId, Convert.ToBase64String((Byte[])CalIdVal));
ItemView ivItemView = new ItemView(1);
FindItemsResults<Item> fiResults = AtndCalendar.FindItems(sfSearchFilter, ivItemView);
if (fiResults.Items.Count > 0) {
    //do whatever
}