EWS - 给定约会,获取约会所有者的副本

本文关键字:约会 所有者 副本 获取 EWS | 更新日期: 2023-09-27 17:55:59

给定 EWS 中的约会,是否可以获得所有者的副本?

例如,如果我以user1身份登录,我有user1 user2创建的约会副本,我有冒充权限,我想编辑user2的约会副本,我怎样才能获得user2的副本?

EWS - 给定约会,获取约会所有者的副本

您可以使用

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
}