Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# EWS-如果有预约,请联系车主';这是预约的复印件_C#_Exchangewebservices - Fatal编程技术网

C# EWS-如果有预约,请联系车主';这是预约的复印件

C# EWS-如果有预约,请联系车主';这是预约的复印件,c#,exchangewebservices,C#,Exchangewebservices,如果在EWS中有预约,是否可以获得所有者的副本 例如,如果我以user1的身份登录,我有user1的约会副本,该约会是由user2创建的,我有模拟权限,我想编辑user2的约会副本,如何获取user2的副本?您可以使用将在会议邀请/更新和约会对象上设置的PidLidCleanGlobalObjectId在与会者或组织者邮箱中搜索会议,例如 Appointment newAppointment = new Appointment(service); newAppointment.Subject =

如果在EWS中有预约,是否可以获得所有者的副本


例如,如果我以
user1
的身份登录,我有
user1
的约会副本,该约会是由
user2
创建的,我有模拟权限,我想编辑
user2
的约会副本,如何获取
user2
的副本?

您可以使用将在会议邀请/更新和约会对象上设置的PidLidCleanGlobalObjectId在与会者或组织者邮箱中搜索会议,例如

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
}
Appointment newAppointment=新预约(服务);
newAppointment.Subject=“测试对象”;
newAppointment.Start=新日期时间(2016,08,27,17,00,0);
newAppointment.StartTimeZone=TimeZoneInfo.Local;
newAppointment.EndTimeZone=TimeZoneInfo.Local;
newAppointment.End=newAppointment.Start.AddMinutes(30);
newAppointment.Save();
newAppointment.Body=newmessagebody(Microsoft.Exchange.WebServices.Data.BodyType.Text,“测试”);
newAppointment.RequiredAttenders.Add(“attendee@domain.com");
newAppointment.Update(ConflictResolutionMode.AlwaysOverwrite、SendInvitations或CancellationMode.SendOnlyToAll);
ExtendedPropertyDefinition CleanGlobalObjectId=新的ExtendedPropertyDefinition(DefaultExtendedPropertySet.Meeting,0x23,MapPropertyType.Binary);
PropertySet psPropSet=新的PropertySet(BasePropertySet.FirstClassProperties);
添加(CleanGlobalObjectId);
newAppointment.Load(psPropSet);
对象CalIdVal=null;
newAppointment.TryGetProperty(CleanGlobalObjectId,out-CalIdVal);
文件夹AtndCalendar=Folder.Bind(服务,新文件夹ID(WellKnownFolderName.Calendar,)attendee@domain.com"));
SearchFilter sfSearchFilter=newsearchfilter.IsEqualTo(CleanGlobalObjectId,Convert.ToBase64String((字节[])CalIdVal));
ItemView ivItemView=新的ItemView(1);
FindItemsResults fiResults=AtndCalendar.FindItems(sfSearchFilter,ivItemView);
如果(fiResults.Items.Count>0){
//做任何事
}

我发现这种方法存在一些问题。首先,一个系列中的所有重复事件都具有相同的
PidLidCleanGlobalObjectId
,其次,有时
PidLidCleanGlobalObjectId
为空(我还不知道为什么)。您从源代码中获得了实例信息(例如时间/日期),因此需要使用它,如果它是一个普通实例,那么就没有真正的约会对象可以绑定到它,如果它是一个异常,那么它只是相对的。每个约会都应该有GOID属性(日历不起作用,日历修复会扫描并修复它),我建议您使用Mapi编辑器查看对象。