Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/315.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#_Exchange Server_Exchangewebservices - Fatal编程技术网

如何使用c#从EWS获取定期会议的发生次数?

如何使用c#从EWS获取定期会议的发生次数?,c#,exchange-server,exchangewebservices,C#,Exchange Server,Exchangewebservices,下面是用于修改和删除定期会议事件的链接 我的问题是,我们如何从ews获取事件数,或者有没有办法找到它 Appointment occurrence = Appointment.BindToOccurrence(service, new ItemId(sRecurringMasterId), 3); 在上面的代码中,他们硬编码的事件编号为3,但我如何动态获取此信息?没有直接的方法,我所做的是: 获得作为复发大师的预约 如果没有重复,请定义重复的开始和结束时间 结束时间,就像永远过去一样,然后我

下面是用于修改和删除定期会议事件的链接

我的问题是,我们如何从ews获取事件数,或者有没有办法找到它

Appointment occurrence = Appointment.BindToOccurrence(service, new ItemId(sRecurringMasterId), 3);

在上面的代码中,他们硬编码的事件编号为3,但我如何动态获取此信息?

没有直接的方法,我所做的是:

  • 获得作为复发大师的预约
  • 如果没有重复,请定义重复的开始和结束时间 结束时间,就像永远过去一样,然后我定义了天数 我会在里面搜索
  • 根据以前的计时查找约会
  • 根据类型AppointType.Occurrence筛选结果,然后 数一数你得到了什么
  • 下面的代码解释了我上面写的内容

    var occurrencesCounter = 0;  
    if (appointment.AppointmentType == AppointmentType.RecurringMaster) 
    { 
        appointments = ppointment.Service.FindAppointments(WellKnownFolderName.Calendar, new CalendarView(appointment.Start, (appointment.Recurrence.EndDate == null ? DateTime.Today.AddDays(7) : (DateTime)appointment.Recurrence.EndDate)));
        foreach (var apt in appointments)
        {
            if (apt.AppointmentType == AppointmentType.Occurrence)
            {
                occurrencesCounter++;
            }
        } 
    }