• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
yunhuasheng's blog
everything that we can't do now ,but future with our endeavor. springfield!
博客园    首页    新随笔    联系   管理    订阅  订阅

开发有Recurrence 的约会或会议

开发有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();

        }

posted @ 2007-12-28 16:02  yunhuasheng  阅读(915)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3