How to obtain FolderType from a Folder

  • Thread starter Thread starter Nimpie
  • Start date Start date
N

Nimpie

I can I get the FolderType of a selected folder? For example: each Personal Folder has a Deleted Items folder. I want to iterate over the Personal Folders' Foldders list and get the FolderType (olFolderInbox, olFolderOutbox, etc.) for each folder. Any ideas?

Nimpie
 
MAPIFolder.DefaultItemType and .DefaultMessageClass will tell you the type of folder. If you actually want to match a folder to the default Inbox say, you can compare the folder EntryID's. Get the default Inbox (NameSpace.GetDefaultFolder(olFolderInbox) and its EntryID. Then compare the EntryID's of the folders you are iterating with that saved EntryID.




I can I get the FolderType of a selected folder? For example: each Personal Folder has a Deleted Items folder. I want to iterate over the Personal Folders' Foldders list and get the FolderType (olFolderInbox, olFolderOutbox, etc.) for each folder. Any ideas?

Nimpie
 
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

MAPIFolder.DefaultItemType and .DefaultMessageClass will tell you the type of folder. If you actually want to match a folder to the default Inbox say, you can compare the folder EntryID's. Get the default Inbox (NameSpace.GetDefaultFolder(olFolderInbox) and its EntryID. Then compare the EntryID's of the folders you are iterating with that saved EntryID.




I can I get the FolderType of a selected folder? For example: each Personal Folder has a Deleted Items folder. I want to iterate over the Personal Folders' Foldders list and get the FolderType (olFolderInbox, olFolderOutbox, etc.) for each folder. Any ideas?

Nimpie
 
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
 
Back
Top