none
Want to give specific date for recurrence appointment for quaterly and half yearly occurrence RRS feed

  • Question

  • Hello ,

    I am able to create appointment recurrence for every 6 months(half yearly) pattern but i want them to occur on particular date of that month like 18 of every month. Same as we have recurrence setup in outlook 365 and same should work for lower version of office/outlook also.

    I am dong this in c# which create appointment recurrence in outlook.

    Code part :

    Note : half yearly not allowing to set a specific date. part is commented.

    switch(recurrenceType)
                    {
                     case "Annually" :
                               pattern.RecurrenceType = Outlook.OlRecurrenceType.olRecursYearly;
                               pattern.MonthOfYear = pattern.PatternStartDate.Month;
                                break;
                     case "Half Yearly":
                                pattern.RecurrenceType = Outlook.OlRecurrenceType.olRecursMonthNth    ;
                                //int d = pattern.PatternStartDate.Date.Day;
                                //pattern.DayOfMonth = d;
                                pattern.Interval = 6;
                                break;
                     case "Quarterly":
                                pattern.RecurrenceType = Outlook.OlRecurrenceType.olRecursMonthNth;
                               pattern.Interval = 3;   

    Need urgent help and input.

    Thanks

    Wednesday, September 19, 2018 10:30 AM

Answers

  • Hi,  nupurd

    The “pattern.Interval” property can be set to a specific date (for example: once every six months)

    pattern.RecurrenceType = Outlook.OlRecurrenceType.olRecursMonthly;         
    pattern.Interval = 6;             
    pattern.DayOfMonth = 18;
    Here is the code below:
          private static 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.olRecursMonthly;
                    pattern.Interval = 6;
                    pattern.DayOfMonth = 18;
                    pattern.StartTime = DateTime.Parse("9:00:00 AM");
                    pattern.EndTime = DateTime.Parse("10:00:00 AM");
                    pattern.Duration = 60;
                    pattern.PatternStartDate = DateTime.Parse("11/11/2018");
                    pattern.PatternEndDate = DateTime.Parse("12/25/2019");
                    appItem.Subject = "Meeting with the Boss";      
                    appItem.Save();
                    appItem.Display(true);
                    Console.ReadKey(); 
                }
                catch (Exception ex)
                {
                   Console.WriteLine(ex.ToString());
                }
                if (pattern != null)
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(pattern);
                if (appItem != null)
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(appItem);
            }
    


    • Marked as answer by nupurd Monday, October 1, 2018 2:57 PM
    Thursday, September 20, 2018 9:56 AM

All replies

  • Hi,  nupurd

    The “pattern.Interval” property can be set to a specific date (for example: once every six months)

    pattern.RecurrenceType = Outlook.OlRecurrenceType.olRecursMonthly;         
    pattern.Interval = 6;             
    pattern.DayOfMonth = 18;
    Here is the code below:
          private static 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.olRecursMonthly;
                    pattern.Interval = 6;
                    pattern.DayOfMonth = 18;
                    pattern.StartTime = DateTime.Parse("9:00:00 AM");
                    pattern.EndTime = DateTime.Parse("10:00:00 AM");
                    pattern.Duration = 60;
                    pattern.PatternStartDate = DateTime.Parse("11/11/2018");
                    pattern.PatternEndDate = DateTime.Parse("12/25/2019");
                    appItem.Subject = "Meeting with the Boss";      
                    appItem.Save();
                    appItem.Display(true);
                    Console.ReadKey(); 
                }
                catch (Exception ex)
                {
                   Console.WriteLine(ex.ToString());
                }
                if (pattern != null)
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(pattern);
                if (appItem != null)
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(appItem);
            }
    


    • Marked as answer by nupurd Monday, October 1, 2018 2:57 PM
    Thursday, September 20, 2018 9:56 AM
  • Hello Evan,

    Thanks very much for your answer it worked.

    Thanks again Evan.


    • Edited by nupurd Thursday, September 20, 2018 3:46 PM
    Thursday, September 20, 2018 3:46 PM
  • thank you for your reply.Please remember to mark the reply as answer if it helped. Please help us close the thread.Thank you for understanding!
    Friday, September 21, 2018 1:33 AM