开发有Recurrence 的约会或会议

 

最近开发一个outlook addin,要用到outllook calendar,其他有一个功能是新建立一个约会或会议时,这些约会或会议可能有同期性,因此在建立一个约会以后,则设定了固定周期的约会就会自动出现。

由于以前没有做过类似的开发,只是参照了MSDN写了一个创建约会的程序,但是怎么去让它循环这个问题,并不清楚。再看了Outlook.AppointmentItem这个类,发现里面有一个RecurrenceState属性,看上去只有它与Recurrence Appointment有关,但是再认真一看,这个是一个只读属性,不能设的,因此一时陷入困境,不知道怎么去办。

后来上网上查了一下,感觉也没什么结果。

后来,就随便试了一下,程序如下,就可以解决了。希望对大家有所帮助。

private void CreateAppointment()
        {
            Outlook.AppointmentItem pAppointmentitem = null;
            Redemption.SafeAppointmentItem rAppointmentItem = null;
            rAppointmentItem = new Redemption.SafeAppointmentItemClass();
            Outlook.RecurrencePattern iRec = null;
            pAppointmentitem=(Outlook.AppointmentItem) this.OutlookApplication.CreateItem(Outlook.OlItemType.olAppointmentItem);
                
            rAppointmentItem.Item = pAppointmentitem;
                
            pAppointmentitem.Subject = "Test Daily";
                
            pAppointmentitem.Start = DateTime.Parse("2007-12-16 08:00:00.000");

            pAppointmentitem.End = DateTime.Parse("2007-12-16 08:00:00.000").AddMinutes(30);

            pAppointmentitem.AllDayEvent = false;

            pAppointmentitem.Sensitivity = Outlook.OlSensitivity.olPrivate;

             rAppointmentItem.RTFBody = "Test outlook appointment";

            pAppointmentitem.ReminderSet = true;
            pAppointmentitem.ReminderMinutesBeforeStart = 5;

            pAppointmentitem.ReminderPlaySound = false;

           iRec = pAppointmentitem.GetRecurrencePattern();

            iRec.Duration = 30;

            iRec.StartTime = DateTime.Parse("2007-12-16 08:00:00.000");

            iRec.RecurrenceType = Outlook.OlRecurrenceType.olRecursDaily;
            iRec.Interval = 1;
            iRec.NoEndDate = false;
            iRec.PatternEndDate = DateTime.Parse("2007-12-16 08:00:00.000").AddDays(10);
            iRec.Occurrences = 10;
            iRec.PatternStartDate = DateTime.Parse("2007-12-16 08:00:00.000");
                       

            pAppointmentitem.Categories = "";
                    

            pAppointmentitem.Save();

        }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值