public static void Run()
        {
            //ExStart: ModifyDeleteOccurrenceInRecurrence
            DateTime startDate = DateTime.Now.Date.AddHours(12);

            MapiCalendarEventRecurrence   recurrence = new MapiCalendarEventRecurrence();
            MapiCalendarRecurrencePattern pattern    = recurrence.RecurrencePattern = new MapiCalendarDailyRecurrencePattern();

            pattern.PatternType = MapiCalendarRecurrencePatternType.Day;
            pattern.Period      = 1;
            pattern.EndType     = MapiCalendarRecurrenceEndType.NeverEnd;

            DateTime exceptionDate = startDate.AddDays(1);

            // adding one exception
            pattern.Exceptions.Add(new MapiCalendarExceptionInfo
            {
                Location          = "London",
                Subject           = "Subj",
                OriginalStartDate = exceptionDate,
                StartDateTime     = exceptionDate,
                EndDateTime       = exceptionDate.AddHours(5)
            });
            pattern.ModifiedInstanceDates.Add(exceptionDate);
            // every modified instance also has to have an entry in the DeletedInstanceDates field with the original instance date.
            pattern.DeletedInstanceDates.Add(exceptionDate);

            // adding one deleted instance
            pattern.DeletedInstanceDates.Add(exceptionDate.AddDays(2));


            MapiRecipientCollection recColl = new MapiRecipientCollection();

            recColl.Add("*****@*****.**", "receiver", MapiRecipientType.MAPI_TO);
            MapiCalendar newCal = new MapiCalendar(
                "This is Location",
                "This is Summary",
                "This is recurrence test",
                startDate,
                startDate.AddHours(3),
                "*****@*****.**",
                recColl);

            newCal.Recurrence = recurrence;

            using (MemoryStream memory = new MemoryStream())
            {
                PersonalStorage pst            = PersonalStorage.Create(memory, FileFormatVersion.Unicode);
                FolderInfo      calendarFolder = pst.CreatePredefinedFolder("Calendar", StandardIpmFolder.Appointments);
                calendarFolder.AddMapiMessageItem(newCal);
            }
            //ExEnd: ModifyDeleteOccurrenceInRecurrence
        }
Esempio n. 2
0
        public static void Run()
        {
            // The path to the File directory.
            // ExStart:AddMapiCalendarToPST
            string dataDir = RunExamples.GetDataDir_Outlook();

            // Create the appointment
            MapiCalendar appointment = new MapiCalendar(
                "LAKE ARGYLE WA 6743",
                "Appointment",
                "This is a very important meeting :)",
                new DateTime(2012, 10, 2, 13, 0, 0),
                new DateTime(2012, 10, 2, 14, 0, 0));

            // Create the meeting
            MapiRecipientCollection attendees = new MapiRecipientCollection();

            attendees.Add("*****@*****.**", "Renee A. Jones", MapiRecipientType.MAPI_TO);
            attendees.Add("*****@*****.**", "Szollosy Liza", MapiRecipientType.MAPI_TO);

            MapiCalendar meeting = new MapiCalendar(
                "Meeting Room 3 at Office Headquarters",
                "Meeting",
                "Please confirm your availability.",
                new DateTime(2012, 10, 2, 13, 0, 0),
                new DateTime(2012, 10, 2, 14, 0, 0),
                "*****@*****.**",
                attendees
                );

            string path = dataDir + "AddMapiCalendarToPST_out.pst";

            if (File.Exists(path))
            {
                File.Delete(path);
            }

            using (PersonalStorage pst = PersonalStorage.Create(dataDir + "AddMapiCalendarToPST_out.pst", FileFormatVersion.Unicode))
            {
                FolderInfo calendarFolder = pst.CreatePredefinedFolder("Calendar", StandardIpmFolder.Appointments);
                calendarFolder.AddMapiMessageItem(appointment);
                calendarFolder.AddMapiMessageItem(meeting);
            }
            // ExEnd:AddMapiCalendarToPST
        }
        public static void Run()
        {
            // The path to the File directory.
            // ExStart:AddMapiCalendarToPST
            string dataDir = RunExamples.GetDataDir_Outlook();

            // Create the appointment
            MapiCalendar appointment = new MapiCalendar(
                "LAKE ARGYLE WA 6743",
                "Appointment",
                "This is a very important meeting :)",
                new DateTime(2012, 10, 2, 13, 0, 0),
                new DateTime(2012, 10, 2, 14, 0, 0));

            // Create the meeting
            MapiRecipientCollection attendees = new MapiRecipientCollection();
            attendees.Add("*****@*****.**", "Renee A. Jones", MapiRecipientType.MAPI_TO);
            attendees.Add("*****@*****.**", "Szollosy Liza", MapiRecipientType.MAPI_TO);

            MapiCalendar meeting = new MapiCalendar(
                "Meeting Room 3 at Office Headquarters",
                "Meeting",
                "Please confirm your availability.",
                new DateTime(2012, 10, 2, 13, 0, 0),
                new DateTime(2012, 10, 2, 14, 0, 0),
                "*****@*****.**",
                attendees
                );

            string path = dataDir + "AddMapiCalendarToPST_out.pst";

            if (File.Exists(path))
            {
                File.Delete(path);
            }

            using (PersonalStorage pst = PersonalStorage.Create(dataDir + "AddMapiCalendarToPST_out.pst", FileFormatVersion.Unicode))
            {
                FolderInfo calendarFolder = pst.CreatePredefinedFolder("Calendar", StandardIpmFolder.Appointments);
                calendarFolder.AddMapiMessageItem(appointment);
                calendarFolder.AddMapiMessageItem(meeting);
            }
            // ExEnd:AddMapiCalendarToPST
        }