How to use API for save Journal pst file with embed attachment

Hi Teams,

image.png (105.8 KB)

I want to generate this pst file, how can I do?
Can you please give me a demo?

Thanks.
Kent

@Kent.Sun

The PST file is collection of email/MSG and attachments are embedded inside them. Please visit the following documentation link for possible options to work with PST.

@mudassir.fayyaz
Thank you for the issue descriptions.
I tried a demo.
string dataDir = RunExamples.GetDataDir_Outlook();

        string[] attachFileNames = new string[] { dataDir + "Desert.jpg", dataDir + "download.png" };

        MapiJournal journal = new MapiJournal("testJournal", "This is a test journal", "Phone call", "Phone call");
        journal.StartTime = DateTime.Now;
        journal.EndTime = journal.StartTime.AddHours(1);
        journal.Companies = new string[] { "company 1", "company 2", "company 3" };

        foreach (string attach in attachFileNames)
        {
            journal.Attachments.Add(attach,File.ReadAllBytes(attach));
        }
        journal.Save(dataDir + "AddAttachmentsToMapiJournal_out.msg");
        using (var personalStorage = PersonalStorage.Create(dataDir + "CreateNewMapiJournalAndAddToSubfolder_out29.pst", FileFormatVersion.Unicode))
        {
            var journalFolder = personalStorage.CreatePredefinedFolder("Journal", StandardIpmFolder.Journal);
            journalFolder.AddMapiMessageItem(journal);
        }

Then I imported the pst file into outlook, the result is
journal.png (20.9 KB)
These images are not showed.
How we should show them?

@Kent.Sun

Can you please provide the working sample code along with source files and output PST. Please also share the desired output as well. Also, it is not the issue on PST but likely an issue with MSG file. Please try opening the MSG file directly in Outlook as well to verify the behaviour.

@mudassir.fayyaz
Thanks. We resolved this issue.
If the AttatchMethod is 6, we need remove the property ‘PR_ATTACH_DATA_BIN’.

@Kent.Sun

Thank you for sharing the feedback. It’s good to know things are resolved on your end.