Namespae::GetFolderFromID call

  • Thread starter Thread starter Semut
  • Start date Start date
S

Semut

I notice that the Namespace::GetFolderFromID capable of getting the
MAPIFolder from any profiles. Even MAPIFolder from non default profile. It
is powerful, yes but it arouse a problem in my case for checking the
MAPIFolder validity. Usually, I would check if the MAPIFolder exist by

if (spMAPIFolder != NULL)
{
......

Now, this checking will not work anymore.

My question will be, how to know if the MAPIFolder is from the required
logon? Any function for that?


thank you.
 
This is a pecularity of the PST provider (that's what you are using,
right?) - PST store entry id includes the full path to the PST file. If the
PST provider is loaded in the current profile, MAPI will be able to open any
PST store even if it is not in the current profile.
To work around that, you can loop through all top folders in the
Namespace.Folder collection and check the StoreID of each top folder first
before using GetFolderFromID.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
thanx

Yes, i am using the PST provider.

Doesn't MAPI or CDO or Redemption have some form of functions to check to
which profile the MAPIFolder belongs to? I was expecting something trivial
thou than having to write out some algorithms for this purpose.
 
A particular folder can be accessed from multiple profiles, so no, there can
be no such check.
You can still however loop through the Namespace.Folders root folders
collection and check the StoreID property against the given store id to make
sure the store (PST file) is used in the current session.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Back
Top