示例#1
0
        public static void Run()
        {
            // The path to the File directory.
            // ExStart:AddMapiTaskToPST
            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;

            string alreadyCreated = dataDir + "AddMapiTaskToPST_out.pst";

            if (File.Exists(alreadyCreated))
            {
                File.Delete(alreadyCreated);
            }
            else
            {
            }

            using (PersonalStorage personalStorage = PersonalStorage.Create(dataDir + "AddMapiTaskToPST_out.pst", FileFormatVersion.Unicode))
            {
                FolderInfo taskFolder = personalStorage.CreatePredefinedFolder("Tasks", StandardIpmFolder.Tasks);
                taskFolder.AddMapiMessageItem(task);
            }
            // ExEnd:AddMapiTaskToPST
        }
示例#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
        }
示例#3
0
        public static void Run()
        {
            // ExStart:AddMapiNoteToPST
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            MapiMessage mess = MapiMessage.FromFile(dataDir + "Note.msg");

            // Create three Notes
            MapiNote note1 = (MapiNote)mess.ToMapiMessageItem();

            note1.Subject = "Yellow color note";
            note1.Body    = "This is a yellow color note";

            MapiNote note2 = (MapiNote)mess.ToMapiMessageItem();

            note2.Subject = "Pink color note";
            note2.Body    = "This is a pink color note";
            note2.Color   = NoteColor.Pink;

            MapiNote note3 = (MapiNote)mess.ToMapiMessageItem();

            note2.Subject = "Blue color note";
            note2.Body    = "This is a blue color note";
            note2.Color   = NoteColor.Blue;
            note3.Height  = 500;
            note3.Width   = 500;

            string path = dataDir + "AddMapiNoteToPST_out.pst";

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

            using (PersonalStorage personalStorage = PersonalStorage.Create(dataDir + "AddMapiNoteToPST_out.pst", FileFormatVersion.Unicode))
            {
                FolderInfo notesFolder = personalStorage.CreatePredefinedFolder("Notes", StandardIpmFolder.Notes);
                notesFolder.AddMapiMessageItem(note1);
                notesFolder.AddMapiMessageItem(note2);
                notesFolder.AddMapiMessageItem(note3);
            }
            // ExEnd:AddMapiNoteToPST
        }
示例#4
0
        public static void Run()
        {
            // The path to the File directory.
            // ExStart:CreateNewMapiCalendarAndAddToCalendarSubfolder
            string      dataDir = RunExamples.GetDataDir_Outlook();
            MapiMessage message = MapiMessage.FromFile(dataDir + "Note.msg");

            // Note #1
            MapiNote note1 = (MapiNote)message.ToMapiMessageItem();

            note1.Subject = "Yellow color note";
            note1.Body    = "This is a yellow color note";

            // Note #2
            MapiNote note2 = (MapiNote)message.ToMapiMessageItem();

            note2.Subject = "Pink color note";
            note2.Body    = "This is a pink color note";
            note2.Color   = NoteColor.Pink;

            // Note #3
            MapiNote note3 = (MapiNote)message.ToMapiMessageItem();

            note2.Subject = "Blue color note";
            note2.Body    = "This is a blue color note";
            note2.Color   = NoteColor.Blue;
            note3.Height  = 500;
            note3.Width   = 500;

            if (File.Exists(dataDir + "SampleNote_out.pst"))
            {
                File.Delete(dataDir + "SampleNote_out.pst");
            }

            using (PersonalStorage pst = PersonalStorage.Create(dataDir + "SampleNote_out.pst", FileFormatVersion.Unicode))
            {
                FolderInfo notesFolder = pst.CreatePredefinedFolder("Notes", StandardIpmFolder.Notes);
                notesFolder.AddMapiMessageItem(note1);
                notesFolder.AddMapiMessageItem(note2);
                notesFolder.AddMapiMessageItem(note3);
            }
            // ExEnd:CreateNewMapiCalendarAndAddToCalendarSubfolder
        }
        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
        }
        public static void Run()
        {
            // The path to the File directory.
            // ExStart:CreateNewMapiJournalAndAddToSubfolder
            string      dataDir = RunExamples.GetDataDir_Outlook();
            MapiJournal journal = new MapiJournal("daily record", "called out in the dark", "Phone call", "Phone call");

            journal.StartTime = DateTime.Now;
            journal.EndTime   = journal.StartTime.AddHours(1);

            string path = dataDir + "CreateNewMapiJournalAndAddToSubfolder_out.pst";

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

            using (PersonalStorage personalStorage = PersonalStorage.Create(dataDir + "CreateNewMapiJournalAndAddToSubfolder_out.pst", FileFormatVersion.Unicode))
            {
                FolderInfo journalFolder = personalStorage.CreatePredefinedFolder("Journal", StandardIpmFolder.Journal);
                journalFolder.AddMapiMessageItem(journal);
            }
            // ExEnd:CreateNewMapiJournalAndAddToSubfolder
        }
示例#7
0
        public static void Run()
        {
            // The path to the File directory.
            // ExStart:CreateNewMapiContactAndAddToContactsSubfolder
            string dataDir = RunExamples.GetDataDir_Outlook();

            // Create three Contacts
            MapiContact contact1 = new MapiContact("Sebastian Wright", "*****@*****.**");
            MapiContact contact2 = new MapiContact("Wichert Kroos", "*****@*****.**", "Grade A Investment");
            MapiContact contact3 = new MapiContact("Christoffer van de Meeberg", "*****@*****.**", "Krauses Sofa Factory", "046-630-4614046-630-4614");

            // Contact #4
            MapiContact contact4 = new MapiContact();

            contact4.NameInfo            = new MapiContactNamePropertySet("Margaret", "J.", "Tolle");
            contact4.PersonalInfo.Gender = MapiContactGender.Female;
            contact4.ProfessionalInfo    = new MapiContactProfessionalPropertySet("Adaptaz", "Recording engineer");
            contact4.PhysicalAddresses.WorkAddress.Address = "4 Darwinia Loop EIGHTY MILE BEACH WA 6725";
            contact4.ElectronicAddresses.Email1            = new MapiContactElectronicAddress("Hisen1988", "SMTP", "*****@*****.**");
            contact4.Telephones.BusinessTelephoneNumber    = "(08)9080-1183";
            contact4.Telephones.MobileTelephoneNumber      = "(925)599-3355(925)599-3355";

            // Contact #5
            MapiContact contact5 = new MapiContact();

            contact5.NameInfo            = new MapiContactNamePropertySet("Matthew", "R.", "Wilcox");
            contact5.PersonalInfo.Gender = MapiContactGender.Male;
            contact5.ProfessionalInfo    = new MapiContactProfessionalPropertySet("Briazz", "Psychiatric aide");
            contact5.PhysicalAddresses.WorkAddress.Address = "Horner Strasse 12 4421 SAASS";
            contact5.Telephones.BusinessTelephoneNumber    = "0650 675 73 300650 675 73 30";
            contact5.Telephones.HomeTelephoneNumber        = "(661)387-5382(661)387-5382";

            // Contact #6
            MapiContact contact6 = new MapiContact();

            contact6.NameInfo         = new MapiContactNamePropertySet("Bertha", "A.", "Buell");
            contact6.ProfessionalInfo = new MapiContactProfessionalPropertySet("Awthentikz", "Social work assistant");
            contact6.PersonalInfo.PersonalHomePage         = "B2BTies.com";
            contact6.PhysicalAddresses.WorkAddress.Address = "Im Astenfeld 59 8580 EDELSCHROTT";
            contact6.ElectronicAddresses.Email1            = new MapiContactElectronicAddress("Experwas", "SMTP", "*****@*****.**");
            contact6.Telephones = new MapiContactTelephonePropertySet("06605045265");

            // Load the Outlook file
            string path = dataDir + "SampleContacts_out.pst";

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

            using (PersonalStorage personalStorage = PersonalStorage.Create(dataDir + "SampleContacts_out.pst", FileFormatVersion.Unicode))
            {
                FolderInfo contactFolder = personalStorage.CreatePredefinedFolder("Contacts", StandardIpmFolder.Contacts);
                contactFolder.AddMapiMessageItem(contact1);
                contactFolder.AddMapiMessageItem(contact2);
                contactFolder.AddMapiMessageItem(contact3);
                contactFolder.AddMapiMessageItem(contact4);
                contactFolder.AddMapiMessageItem(contact5);
                contactFolder.AddMapiMessageItem(contact6);
            }
            // ExEnd:CreateNewMapiContactAndAddToContactsSubfolder
        }
        public static void Run()
        {
            // The path to the File directory.
            // ExStart:CreateDistributionListInPST
            string dataDir = RunExamples.GetDataDir_Outlook();

            string displayName1 = "Sebastian Wright";
            string email1       = "*****@*****.**";

            string displayName2 = "Wichert Kroos";
            string email2       = "*****@*****.**";

            string strEntryId1;
            string strEntryId2;

            string path = dataDir + "CreateDistributionListInPST_out.pst";

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

            // Create distribution list from contacts
            using (PersonalStorage personalStorage = PersonalStorage.Create(dataDir + "CreateDistributionListInPST_out.pst", FileFormatVersion.Unicode))
            {
                // Add the contact folder to pst
                FolderInfo contactFolder = personalStorage.CreatePredefinedFolder("Contacts", StandardIpmFolder.Contacts);

                // Create contacts
                strEntryId1 = contactFolder.AddMapiMessageItem(new MapiContact(displayName1, email1));
                strEntryId2 = contactFolder.AddMapiMessageItem(new MapiContact(displayName2, email2));

                // Create distribution list on the base of the created contacts
                MapiDistributionListMember member1 = new MapiDistributionListMember(displayName1, email1);
                member1.EntryIdType = MapiDistributionListEntryIdType.Contact;
                member1.EntryId     = Convert.FromBase64String(strEntryId1);

                MapiDistributionListMember member2 = new MapiDistributionListMember(displayName2, email2);
                member2.EntryIdType = MapiDistributionListEntryIdType.Contact;
                member2.EntryId     = Convert.FromBase64String(strEntryId2);

                MapiDistributionListMemberCollection members = new MapiDistributionListMemberCollection();
                members.Add(member1);
                members.Add(member2);

                MapiDistributionList distributionList = new MapiDistributionList("Contact list", members);
                distributionList.Body    = "Distribution List Body";
                distributionList.Subject = "Sample Distribution List using Aspose.Email";

                // Add distribution list to PST
                contactFolder.AddMapiMessageItem(distributionList);
            }


            string path1 = dataDir + "CreateDistributionListInPST_OneOffmembers_out.pst";

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

            // Create one-off distribution list members (for which no separate contacts were created)
            using (PersonalStorage personalStorage = PersonalStorage.Create(dataDir + "CreateDistributionListInPST_OneOffmembers_out.pst", FileFormatVersion.Unicode))
            {
                // Add the contact folder to pst
                FolderInfo contactFolder = personalStorage.CreatePredefinedFolder("Contacts", StandardIpmFolder.Contacts);

                MapiDistributionListMemberCollection oneOffmembers = new MapiDistributionListMemberCollection();
                oneOffmembers.Add(new MapiDistributionListMember("John R. Patrick", "*****@*****.**"));
                oneOffmembers.Add(new MapiDistributionListMember("Tilly Bates", "*****@*****.**"));

                MapiDistributionList oneOffMembersList = new MapiDistributionList("Simple list", oneOffmembers);
                contactFolder.AddMapiMessageItem(oneOffMembersList);
            }
            // ExEnd:CreateDistributionListInPST
        }