![](/img/trans.png)
[英]Determining if Outlook Appointment is opened as Single Occurrence or Series?
[英]How to the Outlook Appointment series master from a single occurence
打開約會實例后,我需要獲取會議系列的主要約會。
我嘗試了以下操作(currentAppointment變量的類型為AppointmentItem)
DateTime sd = currentAppointment.GetRecurrencePattern().PatternStartDate;
DateTime st = currentAppointment.GetRecurrencePattern().StartTime;
AppointmentItem ai = currentAppointment.GetRecurrencePattern().GetOccurrence(sd+st.TimeOfDay);
但是,盡管這使我獲得了該系列的第一個約會,但它的olapptOccurrence的RecurrenceState。
如何獲得olApptMaster的參考-即會議系列?
AppointmentItem.Parent將為重復實例和異常返回父AppointmentItem。
我有一種方法可以重復創建約會項目,但它與修改約會項目幾乎相同,請告訴我是否有幫助,以及是否需要更多信息。
這是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/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.