当打开一个约会实例时,我需要获取会议系列的主约会。
我尝试过以下方法(currentAppointment变量的类型为AppointmentItem)
DateTime sd = currentAppointment.GetRecurrencePattern().PatternStartDate;
DateTime st = currentAppointment.GetRecurrencePattern().StartTime;
AppointmentItem ai = currentAppointment.GetRecurrencePattern().GetOccurrence(sd+st.TimeOfDay);
然而,虽然这让我获得了本系列中的第一个约会,但它的RecurrenceState为olApptOccurrence。
我如何才能获得olApptMaster -即会议系列的参考资料?
发布于 2013-02-07 21:41:25
AppointmentItem.Parent将返回重复实例和异常的父AppointmentItem。
发布于 2013-02-07 20:29:02
我有一个方法来创建一个定期约会项目,但它几乎与修改一个一样,告诉我这是否对你有帮助,如果你需要进一步的信息。
以下是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);
}
}
来源:http://www.add-in-express.com/creating-addins-blog/2011/11/07/outlook-recurring-appointment/
https://stackoverflow.com/questions/14750975
复制相似问题