ConvertPersonalStorageToMbox Sample

Hello,
Is there any .NET sample for ConvertPersonalStorageToMbox overloads?
Thanks.

@australian.dev.nerds

Please check the following code examples. Hope this helps you.

PersonalStorage pst = PersonalStorage.FromFile("in.pst");
MailboxConverter.ConvertPersonalStorageToMbox(pst, "out.mbox", null);
PersonalStorage ost = PersonalStorage.FromFile("in.ost", false);

MboxStorageWriter writer = new MboxrdStorageWriter("out.mbox", false);

MailboxConverter.ConvertPersonalStorageToMbox(ost, writer, null);

1 Like

Hello,
Please kindly clarify the difference between the above 2 samples, they are identical but the 2nd one has a mid-stage MboxStorageWriter involved.

The 1st one: MailboxConverter directly writes to the target
The 2nd one: MboxStorageWriter in involved and writes the output.

Thanks :slight_smile:

@australian.dev.nerds

You can use one of them to achieve your requirement. Please use the first code example and let us know if you face any issue.

1 Like

Hello,
Sure I have tested both and both were working.
My question is the difference under the hood, using a mid-stage MboxrdStorageWriter will result in less performance for huge conversations or have some other advantages?
Perhaps the developer who knows the underlying code will have some idea :slight_smile:

@australian.dev.nerds

A ticket has been logged for your requirement as EMAILNET-40794. We will inform you once there is an update available on it.

@australian.dev.nerds

The only difference in conversion when using Writer is the ability to convert multiple PST’s into one MBOX.

using (MboxStorageWriter writer = new MboxrdStorageWriter(File.Create(outputFile), false))
{
    PersonalStorage pst1 = PersonalStorage.FromFile(inputFile1, false);
    MailboxConverter.ConvertPersonalStorageToMbox(pst1, writer, null);
    PersonalStorage pst2 = PersonalStorage.FromFile(inputFile2, false);
    MailboxConverter.ConvertPersonalStorageToMbox(pst2, writer, null); 
}
1 Like

Thanks for the valuable info, really appreciate it, please add such important info to the docs, will save both parties time :slight_smile:

@australian.dev.nerds

Sure, we will add such information in APIs.