Free Support Forum - aspose.com

Large pst file size

Hi

We have noticed that PSTs generated from even an EML of 1 KB size have large file size. This raises concerns among us. Please assist.

@Acton,

Thank you for contacting Aspose support team.

Unfortunately the pst format does not have the options for message compression. For this it is necessary to look for workarounds, depending on the purposes. As one of the workarounds, we suggest deleting some properties from the message before saving it in the pst. This can reduce the size of pst up to three times. However this is not possible to create PST file similar to Outlook due the difference in implementation.

Following sample code demonstrates removing some properties however you may remove properties of your own choice as per your requirements.

MapiMessage fromFile = MapiMessage.Load(@"test.eml", new EmlLoadOptions());

using (var pst = PersonalStorage.Create(@"out.pst", FileFormatVersion.Unicode))
{
    fromFile.RemoveProperty(MapiPropertyTag.PR_HTML);
    fromFile.RemoveProperty(MapiPropertyTag.PR_BODY);
    fromFile.RemoveProperty(MapiPropertyTag.PR_BODY_W);
    pst.RootFolder.AddMessage(fromFile);
}