The test pst i used is inside uploaded zip file.
unicode-tmp.zip (2.9 MB)
My sample code i use to delete emails from PST is as follow:
private void ReducePSTSample()
string path = @"D:\Temp\unicodepst\unicode-tmp.pst";
var pstFile = PersonalStorage.FromFile(path);
var rootFolder = pstFile.RootFolder;
private void EnumerateFolder(FolderInfo folderInfo)
var beforeDelete = folderInfo.EnumerateMessagesEntryId().ToList();
if (beforeDelete.Count > 0)
foreach (var folder in folderInfo.GetSubFolders(FolderKind.Normal))
After running such code to delete all emails in this pst, i look at the file size and it remains same as original file size and its not compacted. If i use outlook to compact it, it goes down to 265 KB.
Let me know if this is a bug or i’m doing something wrong here.