public static void Run()
        {
            // The path to the File directory.
            string   dataDir   = RunExamples.GetDataDir_Outlook();
            TimeZone localZone = TimeZone.CurrentTimeZone;
            TimeSpan ts        = localZone.GetUtcOffset(DateTime.Now);
            DateTime StartDate = new DateTime(2015, 7, 16);

            StartDate = StartDate.Add(ts);

            DateTime DueDate   = new DateTime(2015, 7, 16);
            DateTime endByDate = new DateTime(2015, 9, 1);

            DueDate   = DueDate.Add(ts);
            endByDate = endByDate.Add(ts);

            MapiTask task = new MapiTask("This is test task", "Sample Body", StartDate, DueDate);

            task.State = MapiTaskState.NotAssigned;

            // ExStart:SetWeeklyEndAfterDateEveryDayRecurrence
            // Set the weekly recurrence
            var rec = new MapiCalendarWeeklyRecurrencePattern
            {
                EndType         = MapiCalendarRecurrenceEndType.EndAfterDate,
                PatternType     = MapiCalendarRecurrencePatternType.Week,
                Period          = 1,
                WeekStartDay    = DayOfWeek.Sunday,
                DayOfWeek       = MapiCalendarDayOfWeek.Friday,
                EndDate         = endByDate,
                OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=WEEKLY;BYDAY=FR;INTERVAL=1"),
            };

            // ExEnd:SetWeeklyEndAfterDateEveryDayRecurrence

            if (rec.OccurrenceCount == 0)
            {
                rec.OccurrenceCount = 1;
            }

            task.Recurrence = rec;
            task.Save(dataDir + "SetWeeklyEndAfterDateEveryDayRecurrence_out.msg", TaskSaveFormat.Msg);

            // ExStart:SetWeeklyEndAfterDateMultipleDaysRecurrence
            var record = new MapiCalendarWeeklyRecurrencePattern
            {
                EndType         = MapiCalendarRecurrenceEndType.EndAfterDate,
                PatternType     = MapiCalendarRecurrencePatternType.Week,
                Period          = 2,
                WeekStartDay    = DayOfWeek.Sunday,
                EndDate         = endByDate,
                DayOfWeek       = MapiCalendarDayOfWeek.Friday | MapiCalendarDayOfWeek.Monday,
                OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=WEEKLY;BYDAY=FR,MO;INTERVAL=2"),
            };

            // ExEnd:SetWeeklyEndAfterDateMultipleDaysRecurrence

            task.Recurrence = record;
            task.Save(dataDir + "SetWeeklyEndAfterDateMultipleDaysRecurrence_out.msg", TaskSaveFormat.Msg);
        }
        public static void Run()
        {
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            DateTime startDate = new DateTime(2015, 04, 30, 10, 00, 00);
            MapiTask task = new MapiTask("abc", "def", startDate, startDate.AddHours(1));
            task.State = MapiTaskState.NotAssigned;

            // Set the weekly recurrence
            var rec = new MapiCalendarDailyRecurrencePattern
            {
                PatternType = MapiCalendarRecurrencePatternType.Day,
                Period = 1,
                WeekStartDay = DayOfWeek.Sunday,
                EndType = MapiCalendarRecurrenceEndType.NeverEnd,
                OccurrenceCount = 0,
            };
            task.Recurrence = rec;
            task.Save(dataDir + "AsposeDaily_out.msg", TaskSaveFormat.Msg);

            // Set the weekly recurrence
            // Set the weekly recurrence
            var rec1 = new MapiCalendarWeeklyRecurrencePattern
            {
                PatternType = MapiCalendarRecurrencePatternType.Week,
                Period = 1,
                DayOfWeek = MapiCalendarDayOfWeek.Wednesday,
                EndType = MapiCalendarRecurrenceEndType.NeverEnd,
                OccurrenceCount = 0,
            };
            task.Recurrence = rec1;
            task.Save(dataDir + "AsposeWeekly_out.msg", TaskSaveFormat.Msg);

            // Set the monthly recurrence
            var recMonthly = new MapiCalendarMonthlyRecurrencePattern
            {
                PatternType = MapiCalendarRecurrencePatternType.Month,
                Period = 1,
                EndType = MapiCalendarRecurrenceEndType.NeverEnd,
                Day = 30,
                OccurrenceCount = 0,
                WeekStartDay = DayOfWeek.Sunday,
            };
            task.Recurrence = recMonthly;
            task.Save(dataDir + "AsposeMonthly_out.msg", TaskSaveFormat.Msg);

            // Set the yearly recurrence
            var recYearly = new MapiCalendarMonthlyRecurrencePattern
            {
                PatternType = MapiCalendarRecurrencePatternType.Month,
                EndType = MapiCalendarRecurrenceEndType.NeverEnd,
                OccurrenceCount = 10,
                Period = 12,
            };
            task.Recurrence = recYearly;
            task.Save(dataDir + "AsposeYearly_out.msg", TaskSaveFormat.Msg);
        }
        public static void Run()
        {
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();
            TimeZone localZone = TimeZone.CurrentTimeZone;
            TimeSpan ts = localZone.GetUtcOffset(DateTime.Now);
            DateTime StartDate = new DateTime(2015, 7, 1);
            StartDate = StartDate.Add(ts);

            DateTime DueDate = new DateTime(2015, 7, 1);
            DateTime endByDate = new DateTime(2015, 12, 31);
            DueDate = DueDate.Add(ts);
            endByDate = endByDate.Add(ts);

            MapiTask task = new MapiTask("This is test task", "Sample Body", StartDate, DueDate);
            task.State = MapiTaskState.NotAssigned;

            // Set the Monthly recurrence
            var rec = new MapiCalendarMonthlyRecurrencePattern
            {
                Day = 15,
                Period = 12,
                PatternType = MapiCalendarRecurrencePatternType.Month,
                EndType = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
                OccurrenceCount = 3,
                WeekStartDay = DayOfWeek.Monday
            };
            task.Recurrence = rec;
            task.Save(dataDir + "Monthly_out.msg", TaskSaveFormat.Msg);
        }
Exemplo n.º 4
0
        public static void Run()
        {
            // ExStart:CreatingAndSavingOutlookTasks
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            MapiTask task = new MapiTask("To Do", "Just click and type to add new task", DateTime.Now, DateTime.Now.AddDays(3));

            task.PercentComplete    = 20;
            task.EstimatedEffort    = 2000;
            task.ActualEffort       = 20;
            task.History            = MapiTaskHistory.Assigned;
            task.LastUpdate         = DateTime.Now;
            task.Users.Owner        = "Darius";
            task.Users.LastAssigner = "Harkness";
            task.Users.LastDelegate = "Harkness";
            task.Users.Ownership    = MapiTaskOwnership.AssignersCopy;
            task.Companies          = new string[] { "company1", "company2", "company3" };
            task.Categories         = new string[] { "category1", "category2", "category3" };
            task.Mileage            = "Some test mileage";
            task.Billing            = "Test billing information";
            task.Users.Delegator    = "Test Delegator";
            task.Sensitivity        = MapiSensitivity.Personal;
            task.Status             = MapiTaskStatus.Complete;
            task.EstimatedEffort    = 5;
            task.Save(dataDir + "MapiTask.msg", TaskSaveFormat.Msg);
            // ExEnd:CreatingAndSavingOutlookTasks
        }
Exemplo n.º 5
0
        public static void Run()
        {
            // The path to the File directory.
            string   dataDir   = RunExamples.GetDataDir_Outlook();
            TimeZone localZone = TimeZone.CurrentTimeZone;
            TimeSpan ts        = localZone.GetUtcOffset(DateTime.Now);
            DateTime StartDate = new DateTime(2015, 7, 1);

            StartDate = StartDate.Add(ts);

            DateTime DueDate   = new DateTime(2015, 7, 1);
            DateTime endByDate = new DateTime(2015, 12, 31);

            DueDate   = DueDate.Add(ts);
            endByDate = endByDate.Add(ts);

            MapiTask task = new MapiTask("This is test task", "Sample Body", StartDate, DueDate);

            task.State = MapiTaskState.NotAssigned;

            // Set the Monthly recurrence
            var rec = new MapiCalendarMonthlyRecurrencePattern
            {
                Day             = 15,
                Period          = 12,
                PatternType     = MapiCalendarRecurrencePatternType.Month,
                EndType         = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
                OccurrenceCount = 3,
                WeekStartDay    = DayOfWeek.Monday
            };

            task.Recurrence = rec;
            task.Save(dataDir + "Monthly_out.msg", TaskSaveFormat.Msg);
        }
        public static void Run()
        {
            string dataDir = RunExamples.GetDataDir_Outlook();

            DateTime StartDate = new DateTime(2015, 7, 16);
            DateTime endByDate = new DateTime(2015, 8, 1);
            DateTime DueDate   = new DateTime(2015, 7, 16);
            MapiTask task      = new MapiTask("This is test task", "Sample Body", StartDate, DueDate);

            task.State = MapiTaskState.NotAssigned;

            // ExStart:SetDailyOccurrenceCount
            // Set the Daily recurrence
            var record = new MapiCalendarDailyRecurrencePattern
            {
                PatternType     = MapiCalendarRecurrencePatternType.Day,
                Period          = 1,
                WeekStartDay    = DayOfWeek.Sunday,
                EndType         = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
                OccurrenceCount = 5,
            };

            task.Recurrence = record;
            // ExEnd:SetDailyOccurrenceCount

            task.Save(dataDir + "SetDailyOccurrenceCount_out.msg", TaskSaveFormat.Msg);
        }
        public static void Run()
        {
            // ExStart:CreatingAndSavingOutlookTasks
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            MapiTask task = new MapiTask("To Do", "Just click and type to add new task", DateTime.Now, DateTime.Now.AddDays(3));
            task.PercentComplete = 20;
            task.EstimatedEffort = 2000;
            task.ActualEffort = 20;
            task.History = MapiTaskHistory.Assigned;
            task.LastUpdate = DateTime.Now;
            task.Users.Owner = "Darius";
            task.Users.LastAssigner = "Harkness";
            task.Users.LastDelegate = "Harkness";
            task.Users.Ownership = MapiTaskOwnership.AssignersCopy;
            task.Companies = new string[] { "company1", "company2", "company3" };
            task.Categories = new string[] { "category1", "category2", "category3" };
            task.Mileage = "Some test mileage";
            task.Billing = "Test billing information";
            task.Users.Delegator = "Test Delegator";
            task.Sensitivity = MapiSensitivity.Personal;
            task.Status = MapiTaskStatus.Complete;
            task.EstimatedEffort = 5;
            task.Save(dataDir + "MapiTask.msg", TaskSaveFormat.Msg);
            // ExEnd:CreatingAndSavingOutlookTasks
        }
Exemplo n.º 8
0
        public static void Run()
        {
            string dataDir = RunExamples.GetDataDir_Outlook();

            // ExStart:ReadingVToDoTask
            MapiTask task = MapiTask.FromVTodo(dataDir + "VToDoTask.ics");

            task.Save(dataDir + "VToDo_out.msg", TaskSaveFormat.Msg);
            // ExEnd:ReadingVToDoTask
        }
        public static void Run()
        {
            string dataDir = RunExamples.GetDataDir_Outlook();

            DateTime StartDate = new DateTime(2015, 7, 16);
            DateTime endByDate = new DateTime(2015, 8, 1);
            DateTime DueDate   = new DateTime(2015, 7, 16);
            MapiTask task      = new MapiTask("This is test task", "Sample Body", StartDate, DueDate);

            task.State = MapiTaskState.NotAssigned;

            // ExStart:SetRecurrenceEveryDay
            // Set the Daily recurrence
            var record = new MapiCalendarDailyRecurrencePattern
            {
                PatternType     = MapiCalendarRecurrencePatternType.Day,
                Period          = 1,
                EndType         = MapiCalendarRecurrenceEndType.EndAfterDate,
                OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=DAILY;INTERVAL=1"),
                EndDate         = endByDate
            };

            // ExEnd:SetRecurrenceEveryDay

            task.Recurrence = record;
            task.Save(dataDir + "SetRecurrenceEveryDay_out.msg", TaskSaveFormat.Msg);

            // ExStart:SetRecurrenceEveryDayInterval
            // Set the Daily recurrence
            var record1 = new MapiCalendarDailyRecurrencePattern
            {
                PatternType     = MapiCalendarRecurrencePatternType.Day,
                Period          = 2,
                EndType         = MapiCalendarRecurrenceEndType.EndAfterDate,
                OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=DAILY;INTERVAL=2"),
                EndDate         = endByDate
            };

            // ExEnd:SetRecurrenceEveryDayInterval

            task.Recurrence = record;
            task.Save(dataDir + "SetRecurrenceEveryDayInterval_out.msg", TaskSaveFormat.Msg);
        }
        public static void Run()
        {
            // ExStart:AddReminderInformationToMapiTask
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            // Create MapiTask and set Task Properties
            MapiTask testTask = new MapiTask("task with reminder", "this is a body", DateTime.Now, DateTime.Now.AddHours(1));
            testTask.ReminderSet = true;
            testTask.ReminderTime = DateTime.Now;
            testTask.ReminderFileParameter =dataDir + "Alarm01.wav";
            testTask.Save(dataDir + "AddReminderInformationToMapiTask_out", TaskSaveFormat.Msg);
            // ExEnd:AddReminderInformationToMapiTask
        }
        public static void Run()
        {
            // ExStart:AddAttachmentsToMapiTask
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            string attachmentContent = "Test attachment body";
            string attachmentName = "Test attachment name";

            MapiTask testTask = new MapiTask("Task with attacment", "Test body of task with attacment", DateTime.Now, DateTime.Now.AddHours(1));
            testTask.Attachments.Add(attachmentName, Encoding.Unicode.GetBytes(attachmentContent));
            testTask.Save(dataDir + "AddAttachmentsToMapiTask_out", TaskSaveFormat.Msg);
            // ExEnd:AddAttachmentsToMapiTask
        }
Exemplo n.º 12
0
        public static void Run()
        {
            // ExStart:AddAttachmentsToMapiTask
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            string attachmentContent = "Test attachment body";
            string attachmentName    = "Test attachment name";

            MapiTask testTask = new MapiTask("Task with attacment", "Test body of task with attacment", DateTime.Now, DateTime.Now.AddHours(1));

            testTask.Attachments.Add(attachmentName, Encoding.Unicode.GetBytes(attachmentContent));
            testTask.Save(dataDir + "AddAttachmentsToMapiTask_out", TaskSaveFormat.Msg);
            // ExEnd:AddAttachmentsToMapiTask
        }
Exemplo n.º 13
0
        public static void Run()
        {
            // ExStart:AddReminderInformationToMapiTask
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            // Create MapiTask and set Task Properties
            MapiTask testTask = new MapiTask("task with reminder", "this is a body", DateTime.Now, DateTime.Now.AddHours(1));

            testTask.ReminderSet           = true;
            testTask.ReminderTime          = DateTime.Now;
            testTask.ReminderFileParameter = dataDir + "Alarm01.wav";
            testTask.Save(dataDir + "AddReminderInformationToMapiTask_out", TaskSaveFormat.Msg);
            // ExEnd:AddReminderInformationToMapiTask
        }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            DateTime startDate = new DateTime(2015, 04, 30, 10, 00, 00);
            MapiTask task = new MapiTask("abc", "def", startDate, startDate.AddHours(1));
            task.State = MapiTaskState.NotAssigned;

            // Set the weekly recurrence
            var rec = new MapiCalendarDailyRecurrencePattern
            {
                PatternType = MapiCalendarRecurrencePatternType.Day,
                Period = 1,
                WeekStartDay = DayOfWeek.Sunday,
                EndType = MapiCalendarRecurrenceEndType.NeverEnd,
                OccurrenceCount = 0,
            };
            task.Recurrence = rec;
            task.Save("AsposeDaily.msg", TaskSaveFormat.Msg);
        }
Exemplo n.º 15
0
        static void Main(string[] args)
        {
            DateTime startDate = new DateTime(2015, 04, 30, 10, 00, 00);
            MapiTask task      = new MapiTask("abc", "def", startDate, startDate.AddHours(1));

            task.State = MapiTaskState.NotAssigned;

            // Set the weekly recurrence
            var rec = new MapiCalendarDailyRecurrencePattern
            {
                PatternType     = MapiCalendarRecurrencePatternType.Day,
                Period          = 1,
                WeekStartDay    = DayOfWeek.Sunday,
                EndType         = MapiCalendarRecurrenceEndType.NeverEnd,
                OccurrenceCount = 0,
            };

            task.Recurrence = rec;
            task.Save("AsposeDaily.msg", TaskSaveFormat.Msg);
        }
        public static void Run()
        {
            // ExStart:EndAfterNoccurrences
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            TimeZone localZone = TimeZone.CurrentTimeZone;
            TimeSpan timeSpan  = localZone.GetUtcOffset(DateTime.Now);
            DateTime StartDate = new DateTime(2015, 7, 16);

            StartDate = StartDate.Add(timeSpan);

            DateTime DueDate   = new DateTime(2015, 7, 16);
            DateTime endByDate = new DateTime(2015, 8, 1);

            DueDate   = DueDate.Add(timeSpan);
            endByDate = endByDate.Add(timeSpan);

            MapiTask task = new MapiTask("This is test task", "Sample Body", StartDate, DueDate);

            task.State = MapiTaskState.NotAssigned;

            // Set the Daily recurrence
            var rec = new MapiCalendarDailyRecurrencePattern
            {
                PatternType     = MapiCalendarRecurrencePatternType.Day,
                Period          = 1,
                WeekStartDay    = DayOfWeek.Sunday,
                EndType         = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
                OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=DAILY"),
            };

            if (rec.OccurrenceCount == 0)
            {
                rec.OccurrenceCount = 1;
            }

            task.Recurrence = rec;
            task.Save(dataDir + "Daily_out.msg", TaskSaveFormat.Msg);
            // ExEnd:EndAfterNoccurrences
        }
Exemplo n.º 17
0
 static void Main(string[] args)
 {
     MapiTask task = new MapiTask("To Do", "Just click and type to add new task", DateTime.Now, DateTime.Now.AddDays(3));
     task.PercentComplete = 20;
     task.EstimatedEffort = 2000;
     task.ActualEffort = 20;
     task.History = MapiTaskHistory.Assigned;
     task.LastUpdate = DateTime.Now;
     task.Users.Owner = "Darius";
      task.Users.LastAssigner = "Harkness";
     task.Users.LastDelegate = "Harkness";
     task.Users.Ownership = MapiTaskOwnership.AssignersCopy;
     task.Companies = new string[] { "company1", "company2", "company3" };
     task.Categories = new string[] { "category1", "category2", "category3" };
     task.Mileage = "Some test mileage";
     task.Billing = "Test billing information";
     task.Users.Delegator = "Test Delegator";
     task.Sensitivity = MapiSensitivity.Personal;
     task.Status = MapiTaskStatus.Complete;
     task.EstimatedEffort = 5;
     task.Save("MapiTask.msg", TaskSaveFormat.Msg);
 }
        public static void Run()
        {
            // ExStart:EndAfterNoccurrenceSelectMultipleDaysInweek
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();
            TimeZone localZone = TimeZone.CurrentTimeZone;
            TimeSpan ts = localZone.GetUtcOffset(DateTime.Now);
            DateTime StartDate = new DateTime(2015, 7, 16);
            StartDate = StartDate.Add(ts);

            DateTime DueDate = new DateTime(2015, 7, 16);
            DateTime endByDate = new DateTime(2015, 9, 1);
            DueDate = DueDate.Add(ts);
            endByDate = endByDate.Add(ts);

            MapiTask task = new MapiTask("This is test task", "Sample Body", StartDate, DueDate);
            task.State = MapiTaskState.NotAssigned;

            // Set the weekly recurrence
            var rec = new MapiCalendarWeeklyRecurrencePattern
            {
                EndType = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
                PatternType = MapiCalendarRecurrencePatternType.Week,
                Period = 1,
                WeekStartDay = DayOfWeek.Sunday,
                DayOfWeek = MapiCalendarDayOfWeek.Friday | MapiCalendarDayOfWeek.Monday,
                OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=WEEKLY;BYDAY=FR,MO"),
            };

            if (rec.OccurrenceCount == 0)
            {
                rec.OccurrenceCount = 1;
            }

            task.Recurrence = rec;
            task.Save(dataDir + "Weekly_out.msg", TaskSaveFormat.Msg);
            // ExEnd:EndAfterNoccurrenceSelectMultipleDaysInweek
        }
        public static void Run()
        {
            // ExStart:EndAfterNoccurrences
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            TimeZone localZone = TimeZone.CurrentTimeZone;
            TimeSpan timeSpan = localZone.GetUtcOffset(DateTime.Now);
            DateTime StartDate = new DateTime(2015, 7, 16);
            StartDate = StartDate.Add(timeSpan);

            DateTime DueDate = new DateTime(2015, 7, 16);
            DateTime endByDate = new DateTime(2015, 8, 1);
            DueDate = DueDate.Add(timeSpan);
            endByDate = endByDate.Add(timeSpan);
 
            MapiTask task = new MapiTask("This is test task", "Sample Body", StartDate, DueDate);
            task.State = MapiTaskState.NotAssigned;

            // Set the Daily recurrence
            var rec = new MapiCalendarDailyRecurrencePattern
            {
                PatternType = MapiCalendarRecurrencePatternType.Day,
                Period = 1,
                WeekStartDay = DayOfWeek.Sunday,
                EndType = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
                OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=DAILY"),
            };

            if (rec.OccurrenceCount==0)
            {
                rec.OccurrenceCount = 1;
            }

            task.Recurrence = rec;
            task.Save(dataDir + "Daily_out.msg", TaskSaveFormat.Msg);
            // ExEnd:EndAfterNoccurrences
        }
Exemplo n.º 20
0
        static void Main(string[] args)
        {
            MapiTask task = new MapiTask("To Do", "Just click and type to add new task", DateTime.Now, DateTime.Now.AddDays(3));

            task.PercentComplete    = 20;
            task.EstimatedEffort    = 2000;
            task.ActualEffort       = 20;
            task.History            = MapiTaskHistory.Assigned;
            task.LastUpdate         = DateTime.Now;
            task.Users.Owner        = "Darius";
            task.Users.LastAssigner = "Harkness";
            task.Users.LastDelegate = "Harkness";
            task.Users.Ownership    = MapiTaskOwnership.AssignersCopy;
            task.Companies          = new string[] { "company1", "company2", "company3" };
            task.Categories         = new string[] { "category1", "category2", "category3" };
            task.Mileage            = "Some test mileage";
            task.Billing            = "Test billing information";
            task.Users.Delegator    = "Test Delegator";
            task.Sensitivity        = MapiSensitivity.Personal;
            task.Status             = MapiTaskStatus.Complete;
            task.EstimatedEffort    = 5;
            task.Save("MapiTask.msg", TaskSaveFormat.Msg);
        }
        public static void Run()
        {
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            // ExStart:AddRecurrenceToMapiTask
            DateTime startDate = new DateTime(2015, 04, 30, 10, 00, 00);
            MapiTask task      = new MapiTask("abc", "def", startDate, startDate.AddHours(1));

            task.State = MapiTaskState.NotAssigned;

            // Set the weekly recurrence
            var rec = new MapiCalendarDailyRecurrencePattern
            {
                PatternType     = MapiCalendarRecurrencePatternType.Day,
                Period          = 1,
                WeekStartDay    = DayOfWeek.Sunday,
                EndType         = MapiCalendarRecurrenceEndType.NeverEnd,
                OccurrenceCount = 0,
            };

            task.Recurrence = rec;
            task.Save(dataDir + "AsposeDaily_out.msg", TaskSaveFormat.Msg);

            // Set the weekly recurrence
            var rec1 = new MapiCalendarWeeklyRecurrencePattern
            {
                PatternType     = MapiCalendarRecurrencePatternType.Week,
                Period          = 1,
                DayOfWeek       = MapiCalendarDayOfWeek.Wednesday,
                EndType         = MapiCalendarRecurrenceEndType.NeverEnd,
                OccurrenceCount = 0,
            };

            task.Recurrence = rec1;
            task.Save(dataDir + "AsposeWeekly_out.msg", TaskSaveFormat.Msg);

            // Set the monthly recurrence
            var recMonthly = new MapiCalendarMonthlyRecurrencePattern
            {
                PatternType     = MapiCalendarRecurrencePatternType.Month,
                Period          = 1,
                EndType         = MapiCalendarRecurrenceEndType.NeverEnd,
                Day             = 30,
                OccurrenceCount = 0,
                WeekStartDay    = DayOfWeek.Sunday,
            };

            task.Recurrence = recMonthly;
            //task.Save(dataDir + "AsposeMonthly_out.msg", TaskSaveFormat.Msg);

            // Set the yearly recurrence
            var recYearly = new MapiCalendarMonthlyRecurrencePattern
            {
                PatternType     = MapiCalendarRecurrencePatternType.Month,
                EndType         = MapiCalendarRecurrenceEndType.NeverEnd,
                OccurrenceCount = 10,
                Period          = 12,
            };

            task.Recurrence = recYearly;
            //task.Save(dataDir + "AsposeYearly_out.msg", TaskSaveFormat.Msg);
            // ExEnd:AddRecurrenceToMapiTask
        }