I build a browser tool that reads Outlook .pst and .ost files locally. After a file opens, the UI has to select some folder. For a while the rule was: select the first folder that has any messages.
On one fixture that rule picked the wrong folder, and the obvious fix (look for a folder named "Inbox") has a problem of its own. This post covers the replacement: a heuristic, what it's based on, and where it stops.
The failure
pst-extractor 's public test OST is a small Outlook.com cache in the 4 KB-page layout. In its folder tree, the first folder with mail is Deleted Items (one deleted invitation). The Inbox, with ten messages, comes after it. So "first folder with mail" opened the archive on a deleted invitation.
That's one fixture. I'm not claiming every OST is ordered that way. It was enough to show that "first folder with mail" depends on an order the file doesn't promise.
Why not match the name
Special-folder display names are localized, so the Inbox isn't necessarily called "Inbox".…