K
Ken Slovak - [MVP - Outlook]
If each instance of an AdvancedSearch that you create has a unique Tag
property you can sink as many SearchComplete events as you need to (although
at some point you will start to create a drag on the server with your saved
MAPI restrictions). In cases like that I would create a class module the
exposes whatever I need to handle the AdvancedSearch methods and instantiate
an instance of the class for each search and then add the class to a wrapper
collection. When the search was done I'd then get the Results collection
from it and kill the class instance that was no longer needed.
I probably wouldn't use and save search folders for that since a persisted
search folder persists the MAPI restriction. I'd most likely use a grid
control to display the results, with hidden columns in the grid used to
store the EntryID and StoreID of the item for each row in the grid. Then
when the grid was double-clicked I'd handle that event and get the EntryID
and StoreID from the row that was double-clicked and use
NameSpace.GetItemFromID(EntryID, StoreID) to get a handle for the item and
open it. The grid control I'd display on a form with whatever other controls
I needed on the form such as command buttons.
property you can sink as many SearchComplete events as you need to (although
at some point you will start to create a drag on the server with your saved
MAPI restrictions). In cases like that I would create a class module the
exposes whatever I need to handle the AdvancedSearch methods and instantiate
an instance of the class for each search and then add the class to a wrapper
collection. When the search was done I'd then get the Results collection
from it and kill the class instance that was no longer needed.
I probably wouldn't use and save search folders for that since a persisted
search folder persists the MAPI restriction. I'd most likely use a grid
control to display the results, with hidden columns in the grid used to
store the EntryID and StoreID of the item for each row in the grid. Then
when the grid was double-clicked I'd handle that event and get the EntryID
and StoreID from the row that was double-clicked and use
NameSpace.GetItemFromID(EntryID, StoreID) to get a handle for the item and
open it. The grid control I'd display on a form with whatever other controls
I needed on the form such as command buttons.