繁体   English   中英

如何从一次出现到Outlook约会系列母版

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM