问题描述
在EWS中预约后,是否可以获取所有者的副本?
Given an Appointment in EWS, is it possible to get the owner's copy?
例如,如果我以user1
身份登录,则我拥有由user2
创建的约会的user1
副本,我具有模拟权限,并且我想编辑user2
的约会的副本,我如何获得user2
的副本?
For instance, if I am logged in as user1
, I have user1
's copy of an Appointment that was created by user2
, I have impersonation rights, and I want to edit user2
's copy of the Appointment, how can I obtain user2
's copy?
推荐答案
您可以使用PidLidCleanGlobalObjectId https://msdn.microsoft.com/en-us/library/office/cc839502.aspx ,它将在会议邀请/更新和约会对象上都进行设置以搜索会议在与会者"或组织者"邮箱中,例如
You can use the PidLidCleanGlobalObjectId https://msdn.microsoft.com/en-us/library/office/cc839502.aspx which will be set on both the Meeting invitation/update and the Appointment object to search for the Meeting in an Attendee or Orgainizer mailbox eg
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("[email protected]");
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,"[email protected]"));
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
}
这篇关于EWS-进行约会,获取约会的所有者副本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!