Does 'AddStore' function add always at the end?

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)?
 
D

Dmitry Streblechenko \(MVP\)

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
 
S

Sue Mosher [MVP-Outlook]

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
 

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