It won't work for any non-default InfoStore. A brand new PST file has a Deleted Items folder but no Inbox. You can check for that.
The real way to do things isn't exposed in the Outlook object model. You would have to use CDO 1.21 or Extended MAPI. Assuming CDO 1.21 (an optional installation for Outlook 2000 and later) you would get the InfoStore. In the InfoStore is a property PR_IPM_WASTEBASKET_ENTRYID (property tag 0x35E30102) that has the EntryID of the default Deleted Items folder.
In a PST file that has been used to receive email and so has a full complement of default folders there are also PR_IPM_OUTBOX_ENTRYID, PR_IPM_SENTMAIL_ENTRYID, PR_IPM_APPOINTMENT_ENTRYID, PR_IPM_CONTACT_ENTRYID, PR_IPM_DRAFTS_ENTRYID, PR_IPM_JOURNAL_ENTRYID, PR_IPM_NOTE_ENTRYID, PR_IPM_TASK_ENTRYID fields, located at either the InfoStore or InfoStore.RootFolder levels.
To see these fields in Outlook folders and stores use OutlookSpy (
www.dimastr.com). For information about working with CDO see
www.cdolive.com/cdo5.htm for CDO code samples and
www.cdolive.com/cdo10.htm for lists of various CDO property tags.
But does this also work for a Personal Folder file (.pst) which has its own Deleted Items folder? And how do I recognize a
Deleted Items folder with DefaultItemType and DefaultMessageClass since that folder can contain any type of message (so not only the defaults).
Thanks in advance,
Nimpie