[英]How to the Outlook Appointment series master from a single occurence
I need to get the master appointment of the meeting series, when an appointment instance is opened. 打开约会实例后,我需要获取会议系列的主要约会。
I have tried the following (currentAppointment variable is of type AppointmentItem) 我尝试了以下操作(currentAppointment变量的类型为AppointmentItem)
DateTime sd = currentAppointment.GetRecurrencePattern().PatternStartDate;
DateTime st = currentAppointment.GetRecurrencePattern().StartTime;
AppointmentItem ai = currentAppointment.GetRecurrencePattern().GetOccurrence(sd+st.TimeOfDay);
However, while this gets me the first appointment in the series, it has a RecurrenceState of olApptOccurrence. 但是,尽管这使我获得了该系列的第一个约会,但它的olapptOccurrence的RecurrenceState。
How can I get a reference to the olApptMaster - ie the meeting series? 如何获得olApptMaster的参考-即会议系列?
AppointmentItem.Parent将为重复实例和异常返回父AppointmentItem。
I have a method to create an appointment item with recurrence, but it´s almost the same as modifying one, tell me if that helps you and if you need further information. 我有一种方法可以重复创建约会项目,但它与修改约会项目几乎相同,请告诉我是否有帮助,以及是否需要更多信息。
Here is the code in C# 这是C#中的代码
private void CreateNewRecurringAppointment(Outlook._Application OutlookApp)
{
Outlook.AppointmentItem appItem = null;
Outlook.RecurrencePattern pattern = null;
try
{
appItem = OutlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem)
as Outlook.AppointmentItem;
// create a recurrence
pattern = appItem.GetRecurrencePattern();
pattern.RecurrenceType = Outlook.OlRecurrenceType.olRecursWeekly;
pattern.StartTime = DateTime.Parse("9:00:00 AM");
pattern.EndTime = DateTime.Parse("10:00:00 AM");
// we can specify the duration instead of using the EndTime property
// pattern.Duration = 60;
pattern.PatternStartDate = DateTime.Parse("11/11/2011");
pattern.PatternEndDate = DateTime.Parse("12/25/2011");
appItem.Subject = "Meeting with the Boss";
appItem.Save();
appItem.Display(true);
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
finally
{
if (pattern != null)
System.Runtime.InteropServices.Marshal.ReleaseComObject(pattern);
if (appItem != null)
System.Runtime.InteropServices.Marshal.ReleaseComObject(appItem);
}
}
source: http://www.add-in-express.com/creating-addins-blog/2011/11/07/outlook-recurring-appointment/ 来源: http : //www.add-in-express.com/creating-addins-blog/2011/11/07/outlook-recurring-appointment/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.