public static void Run()
        {
            // ExStart:CreateAndSaveDistributionList
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            // Create MapiDistributionListMemberCollection object and add MapiDistributionListMembers
            MapiDistributionListMemberCollection oneOffmembers = new MapiDistributionListMemberCollection();
            oneOffmembers.Add(new MapiDistributionListMember("John R. Patrick", "*****@*****.**"));
            oneOffmembers.Add(new MapiDistributionListMember("Tilly Bates", "*****@*****.**"));

            MapiDistributionList dlist = new MapiDistributionList("Simple list", oneOffmembers);
            // Set MapiDistributionList properties
            dlist.Body = "Test body";
            dlist.Subject = "Test subject";
            dlist.Mileage = "Test mileage";
            dlist.Billing = "Test billing";

            dlist.Save(dataDir + @"distlist_out.msg");
            // ExEnd:CreateAndSaveDistributionList
        }
        public static void Run()
        {
            // ExStart:CreateAndSaveDistributionList
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            // Create MapiDistributionListMemberCollection object and add MapiDistributionListMembers
            MapiDistributionListMemberCollection oneOffmembers = new MapiDistributionListMemberCollection();

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

            MapiDistributionList dlist = new MapiDistributionList("Simple list", oneOffmembers);

            // Set MapiDistributionList properties
            dlist.Body    = "Test body";
            dlist.Subject = "Test subject";
            dlist.Mileage = "Test mileage";
            dlist.Billing = "Test billing";

            dlist.Save(dataDir + @"distlist_out.msg");
            // ExEnd:CreateAndSaveDistributionList
        }
        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
        }
        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
        }