Aspose.Email.Examples.CSharp.Email.Outlook.SaveContactInformation.Run C# (CSharp) Метод

Run() публичный статический Метод

public static Run ( ) : void
Результат void
        public static void Run()
        {
            // ExStart:SaveContactInformation
            // Load the Outlook file
            string dataDir = RunExamples.GetDataDir_Outlook();
 
            // Load the Outlook PST file
            PersonalStorage personalStorage = PersonalStorage.FromFile(dataDir + "Outlook.pst");
            // Get the Contacts folder
            FolderInfo folderInfo = personalStorage.RootFolder.GetSubFolder("Contacts");
            // Loop through all the contacts in this folder
            MessageInfoCollection messageInfoCollection = folderInfo.GetContents();
            foreach (MessageInfo messageInfo in messageInfoCollection)
            {
                // Get the contact information
                MapiContact contact = (MapiContact)personalStorage.ExtractMessage(messageInfo).ToMapiMessageItem();
                // Display some contents on screen
                Console.WriteLine("Name: " + contact.NameInfo.DisplayName + " - " + messageInfo.EntryIdString);
                // Save to disk in vCard VCF format
                contact.Save(dataDir + "Contacts\\" + contact.NameInfo.DisplayName + ".vcf", ContactSaveFormat.VCard);
            }
            // ExEnd:SaveContactInformation
        }
    }
SaveContactInformation