Searching multiple pst files

  • Thread starter Thread starter G.R. Toro
  • Start date Start date
G

G.R. Toro

Hi,

I have some VBA code to search Outlook Journal items, I use something like
this (adapted from vbs):

'Create Outlook, Namespace, Journal Objects and Task Item
olFolderJournal = 11
Set objOutlook = CreateObject("Outlook.application")
Set objNameSpace = objOutlook.GetNameSpace("MAPI")
Set objJournal = objNameSpace.GetDefaultFolder(olFolderJournal)
Set MyOriginalItems = objJournal.Items

'Loop through all journal items, create list of projects and remove
unwanted items from list
nproj = 0
For Each CurrentItem In MyOriginalItems
examine Currentitem, etc
next

This code finds items in the default file (Outlook.pst), but it does not
find items in another pst file (archive1.pst).
How can I modify my code so it searches both pst files (and possible
others)?

As you can see, I am clueless regarding Outlook's handling of pst files.

Thanks,

Gabriel
 
All stores in the current session, regardless of whether they are PST or
something else, are accessible through the Namespace.Folders collection,
which contains the top level folders of all the stores.
You will need to recursively (or not, if you only handle the default Journal
folders) loop through the folders in that collection and process folders
with the DefaultItemType property = 4.

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