Does 'AddStore' function add always at the end?

  • Thread starter Thread starter Kenny
  • Start date Start date
K

Kenny

If I use AddStore or AddStoreEx function to open another

pst file, does it add that always at the end?

for example, If i have 2 folders, and add another pst file

can I access the added folder with index 3(2 + 1)?
 
Absolutely not. For reasons that escape me, AddStore does *not* return the
newly added top level folder or even its store id.
You need to loop through all top level folders (Namespace.Folders) and
remember their store ids (MAPIFolder.StoreID), then call Namespace.AddStore,
then loop through the folders again. The store not in the original
collection is the store you just added.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
That said, I know people who have been using Namespace.Folders.GetLast
without ill effects. I would agree with Dmitry, though, that it's not a sure
thing. The most efficient way to proceed probalby would be to check GetLast
folder against your list of other store IDs.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top