public static void Run() { // The path to the File directory. // ExStart:AddFilesToPST string dataDir = RunExamples.GetDataDir_Outlook(); string path = dataDir + "Ps1_out.pst"; if (File.Exists(path)) { File.Delete(path); } using (PersonalStorage personalStorage = PersonalStorage.Create(dataDir + "Ps1_out.pst", FileFormatVersion.Unicode)) { FolderInfo folder = personalStorage.RootFolder.AddSubFolder("Files"); // Add Document.doc file with the "IPM.Document" message class by default. folder.AddFile(dataDir + "attachment_1.doc", null); } // ExEnd:AddFilesToPST }