public static void Run() { string dataDir = RunExamples.GetDataDir_Outlook(); MapiCalendar calendar = 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)); // ExStart:SavingTheCalendarItemAsMSG calendar.Save(dataDir + "CalendarItemAsMSG_out.Msg", AppointmentSaveFormat.Msg); // ExEnd:SavingTheCalendarItemAsMSG }
public static void Run() { //ExStart:CreatAndSaveCalendaritems // The path to the File directory. string dataDir = RunExamples.GetDataDir_Outlook(); // Create the appointment MapiCalendar calendar = 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)); calendar.Save(dataDir + "CalendarItem_out.ics", AppointmentSaveFormat.Ics); //ExEnd:CreatAndSaveCalendaritems }
// ExStart:GeneratingOccurrencesFromRecurrencePatterns public static void GetOccurences() { // The path to the File directory string dataDir = RunExamples.GetDataDir_KnowledgeBase(); string tempFileName = dataDir + "Sample.pst"; Appointment appointment = CreateAppointment(); MailMessage mailMessage = CreateMessage(); AlternateView alternateView = appointment.RequestApointment(); mailMessage.AddAlternateView(alternateView); MapiMessage mapiMessage = MapiMessage.FromMailMessage(mailMessage); using (PersonalStorage pst = PersonalStorage.Create(tempFileName, FileFormatVersion.Unicode)) { FolderInfo folder = pst.RootFolder.AddSubFolder("Calendar"); folder.AddMessage(mapiMessage); } using (PersonalStorage pst = PersonalStorage.FromFile(tempFileName)) { var folder = pst.RootFolder.GetSubFolder("Calendar"); foreach (MessageInfo messageInfo in folder.GetContents()) { MapiMessage message = pst.ExtractMessage(messageInfo); MapiCalendar meeting = (MapiCalendar)message.ToMapiMessageItem(); using (MemoryStream memoryStream = new MemoryStream()) { meeting.Save(memoryStream); string s = StreamToString(memoryStream); CalendarRecurrence recurrencePattern = new CalendarRecurrence(s); DateCollection occurrences = recurrencePattern.GenerateOccurrences(); foreach (DateTime occurrence in occurrences) { Console.WriteLine("{0}", occurrence); } } } } File.Delete(tempFileName); }
public static void Run() { // ExStart:AddAudioReminderToCalendar // The path to the File directory. string dataDir = RunExamples.GetDataDir_Outlook(); Appointment app = new Appointment("Home", DateTime.Now.AddHours(1), DateTime.Now.AddHours(1), "*****@*****.**", "*****@*****.**"); MailMessage msg = new MailMessage(); msg.AddAlternateView(app.RequestApointment()); MapiMessage mapi = MapiMessage.FromMailMessage(msg); MapiCalendar calendar = (MapiCalendar)mapi.ToMapiMessageItem(); // Set calendar properties calendar.ReminderSet = true; calendar.ReminderDelta = 58;//58 min before start of event calendar.ReminderFileParameter = dataDir + "Alarm01.wav"; string savedFile = (dataDir + "calendarWithAudioReminder_out.ics"); calendar.Save(savedFile, AppointmentSaveFormat.Ics); // ExEnd:AddAudioReminderToCalendar }