Accessing Search Folder programmatically

P

Pradeep

I'm trying to access search folders and items in those folders
programmatically.
I found th following script enumerates all Search folders:
Sub EnumerateSearchFoldersInStores()
Dim olApp As New Outlook.Application
Dim colStores As Outlook.Stores
Dim oStore As Outlook.Store
Dim oSearchFolders As Outlook.Folders
Dim oFolder As Outlook.Folder

On Error Resume Next
Set colStores = olApp.Session.Stores
For Each oStore In colStores
Set oSearchFolders = oStore.GetSearchFolders
For Each oFolder In oSearchFolders
Debug.Print (oFolder.FolderPath)
Next
Next
End Sub

And from folders I can access the items in it.

My problem is, this subroutine is not showing un-acitvated search folders
(folders apperaing partially transparent). If I click once on that search
folder then it gets activated and becomes part of listing in above subroutine.

Also I read somewhere that if I don't access the search folders for few
days, that search folder become inactive. Is there anyway to programmatically
keep the search folder alive.

Thanks & Regards,
Pradeep
 

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