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("[email protected]", "Renee A. Jones", MapiRecipientType.MAPI_TO);
attendees.Add("[email protected]", "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),
"[email protected]",
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
}
}