Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook - General Queries (http://www.outlookbanter.com/outlook-general-queries/)
-   -   Custom Search Folder (http://www.outlookbanter.com/outlook-general-queries/11905-custom-search-folder.html)

[email protected] April 18th 06 10:59 AM

Custom Search Folder
 
Hi!

I would like to know if there is any way to programatically create
your own custom Search Folder from an Outlook add-in, and of course,
add it's own search criteria (I would like to search after a custom
fileld added in certain MailItems). Also, if this is possible, how do I
access it afterwards?
It doesn't matter if this is done via OOM, CDO or Redemption (or
something else?)...is it possible?

Thanks a lot,
Doru


Sue Mosher [MVP-Outlook] April 18th 06 01:22 PM

Custom Search Folder
 
Use the Application.AdvancedSearch method to return a Search object, then use Search.Save to create the search folder. You will be able to use a custom field in the search criteria only if it is defined in the folder(s), not just in individual items.

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/comm....program_v ba

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

wrote in message oups.com...
Hi!

I would like to know if there is any way to programatically create
your own custom Search Folder from an Outlook add-in, and of course,
add it's own search criteria (I would like to search after a custom
fileld added in certain MailItems). Also, if this is possible, how do I
access it afterwards?
It doesn't matter if this is done via OOM, CDO or Redemption (or
something else?)...is it possible?

Thanks a lot,
Doru


[email protected] April 18th 06 03:21 PM

Custom Search Folder
 
Wow! That works like a charm! Thanks a lot! :) I can now create my own
Search Folder, but I still don't understand if, and how can I:
1) programatically find it,
2) edit it if needed (i.e. if the user manually modified it in the
mean time),
3) eventually delete it (will be needed on add-in uninstall).

Thanks again,
Doru


Sue Mosher [MVP-Outlook] April 18th 06 09:10 PM

Custom Search Folder
 
Since the Search.Save function returns a MAPIFolder object, you should be able to get that folder's EntryID at that point for later use with the Namespace.GetFolderFromID method.

You will not be able to edit the search folder settings programmatically. I think you'll be able to delete it, but I haven't tried it.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

wrote in message ups.com...
Wow! That works like a charm! Thanks a lot! :) I can now create my own
Search Folder, but I still don't understand if, and how can I:
1) programatically find it,
2) edit it if needed (i.e. if the user manually modified it in the
mean time),
3) eventually delete it (will be needed on add-in uninstall).

Thanks again,
Doru


Ken Slovak - [MVP - Outlook] April 19th 06 12:07 AM

Custom Search Folder
 
Yeah, you have to get it, delete it and then re-create it if you want to
change the filter. I've done that a lot.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Sue Mosher [MVP-Outlook]" wrote in message
...
Since the Search.Save function returns a MAPIFolder object, you should be
able to get that folder's EntryID at that point for later use with the
Namespace.GetFolderFromID method.

You will not be able to edit the search folder settings programmatically. I
think you'll be able to delete it, but I haven't tried it.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx



[email protected] April 19th 06 09:58 AM

Custom Search Folder
 
Thanks a lot, guys! Seems easy now :)


CrystY April 19th 06 01:02 PM

Custom Search Folder
 
What should be the scope for searching recursivelly in all personal
folders?


Ken Slovak - [MVP - Outlook] April 19th 06 02:41 PM

Custom Search Folder
 
You can't set up a searchfolder that searches across multiple mail stores
(PST files or Exchange mailboxes). Each searchfolder can only search within
its own store.

For a search of a PST file that starts with the top of store and includes
all subfolders use a search string something like this (depending on the
name of your top of store):

strSearch = "'//Personal Folders'"

Note that since there's a space in "Personal Folders" I surrounded it with
single quotes.

Then you would set the SearchSubfolders argument = True.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"CrystY" wrote in message
oups.com...
What should be the scope for searching recursivelly in all personal
folders?



[email protected] April 19th 06 03:35 PM

Custom Search Folder
 
This all works fine, but how can I programatically save my search
folder in a DIFFERENT store then the default one (i.e. Personal
Folders). Probably it's the name parameter in the Save method of the
search object - search_object.Save("name_here"), but I just can't
figure it out.
Thanks!


Sue Mosher [MVP-Outlook] April 19th 06 04:08 PM

Custom Search Folder
 
You can't. Search folders are not actual MAPI folders. They are stored search queries and live in the default store as hidden items.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

wrote in message oups.com...
This all works fine, but how can I programatically save my search
folder in a DIFFERENT store then the default one (i.e. Personal
Folders). Probably it's the name parameter in the Save method of the
search object - search_object.Save("name_here"), but I just can't
figure it out.
Thanks!



All times are GMT +1. The time now is 11:08 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com