Is it possible to find out if a MAPIFolder is in the olDefaultFolders constant list?

D

Daryl

Hi
I would like to know if there is anyway of finding out if a folder is in the
OlDefaultFolder constants.

I can see the method GetDefaultFolder(FolderTypeEnum) and return a
MAPIFolder is there any way to then get from that returned folder if it is a
olFolderInbox for example?

daryl
 
K

Ken Slovak - [MVP - Outlook]

What exactly are you trying to do?

You can find out the default item type of a folder using
MAPIFolder.DefaultItemType.

If you want to know if a specific folder is a default folder, for example
Inbox, as opposed to being a user-created email folder, how you do that
depends on what version of Outlook you are using and what API's you are
using.

Probably the simplest way to find if a folder is one of the default ones
without comparing folder EntryID's is to get the FolderPath property, which
is a string, of the folder and the Inbox folder (or other default folder)
and compare the FolderPath strings.
 
D

Daryl

Thanks for the reply and the information.

What am I trying to do.

I would like to iterate through all the folders in the name space and while
looping through them I would like to see if the folder is one in the
olDefaultFolder constants. It would be nice if a folder had as a property
this constant, then it would be simple to see if it was a folder of
particular interest.

thanks
daryl
 
D

Daryl

Thanks for the reply and the information.

What am I trying to do.

I would like to iterate through all the folders in the name space and while
looping through them I would like to see if the folder is one in the
olDefaultFolder constants. It would be nice if a folder had as a property
this constant, then it would be simple to see if it was a folder of
particular interest.

thanks
daryl
 
K

Ken Slovak - [MVP - Outlook]

At the Outlook object model level comparing the folder paths is probably the
easiest way to go.

At a lower level you can get the EntryID's of the default folders directly
or from properties on the Store and Inbox objects and use a method to
compare the EntryId's. Those should not be directly compared as they can be
short or long term id's that are equivalent but not equal.

But the lower level methods use either deprecated API's such as CDO 1.21 or
3rd party API's such as Redemption (www.dimastr.com/redemption) or Extended
MAPI (C++ or Delphi only).
 
K

Ken Slovak - [MVP - Outlook]

Well, normally I'd be using Redemption or some other lower level API where
I'd have access to a CompareID() type method, and there is the case that in
general the OOM returns the long-term EntryID so you don't have to worry
about long or short term id's, but I'm always leery about trusting a direct
string comparison there. (Nice run on sentence there)

FolderPath should be pretty much a slam dunk for that as long as nothing is
hard-coded, and of course assuming an OOM version that has that property is
being used. NameSpace.GetDefaiultFolder() followed by string equality for
the path of the folder being tested I'd guarantee (as Justin Wilson used to
say with that wonderful Cajun accent <g>).




Perhaps a combination of EntryID and FolderPath comparisons?

--JP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top