Outlook 2003 Advanced Search and display results

M

mithilesh

Hi,

I'm trying to use outlook 2003 plug in application advancedSearch method to
search on
multiple public, inbox with sub folders and than display the results on
outlook windows.

I encountered several problems in the process:

1) display: Enter the search key in txt box and click the Ok button(plug-in
tool on outlook toolbar ) . Search result will be display on outlook explore.


The only method I could find to display to results was using a save method.

Any suggestion and a specily code samples would be helpful.
 
K

Ken Slovak - [MVP - Outlook]

If you want anything else you'd have to construct the display dialog from
scratch. For example a form with a grid control listing all the returns from
your search that you populate from scratch by iterating the Results
collection when AdvancedSearchComplete() fires.
 
M

mithilesh

Thanks Mr. Ken Slovak.

My main purpose is search result display on outlook explore.

Using Microsoft outlook 12.0 Library 9.3 (outlook 2007)

Outlook.MAPIFolder oFolderInbox =
oNameSpace.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
Outlook.Explorer oExplorerInbox =
applicationObject.Explorers.Add(oFolderInbox,
Outlook.OlFolderDisplayMode.olFolderDisplayNoNavigation);

oExplorerInbox.Search(entertxt,
Outlook.OlSearchScope.olSearchScopeCurrentFolder);
oExplorerInbox.ShowPane(Outlook.OlPane.olOutlookBar, true);
oExplorerInbox.Display();

This code is work as search result display on outlook explore. But same code
is not working Microsoft outlook 11.0 Library 9.2 (outlook 2003).
 
K

Ken Slovak - [MVP - Outlook]

What's not working? Do you get any errors? If so what line is causing the
error. The code snippet you showed doesn't do anything to display search
results, so I have no idea what's not working in Outlook 2003.

When you try to run on Outlook 2003 are you using code that references the
Outlook 2003 PIA and not the Outlook 2007 PIA?
 
S

Sue Mosher [MVP-Outlook]

My main purpose is search result display on outlook explore.
oExplorerInbox.Search(entertxt,
Outlook.OlSearchScope.olSearchScopeCurrentFolder);
oExplorerInbox.ShowPane(Outlook.OlPane.olOutlookBar, true);
oExplorerInbox.Display();

The Explorer.Search method is supported only in Outlook 2007, not earlier versions.

In Outlook 2003, you could call Application.AdvancedSearch, save the search as a search folder, then display that folder. Or, do as Ken suggested and build your own display form.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


mithilesh said:
Thanks Mr. Ken Slovak.
Using Microsoft outlook 12.0 Library 9.3 (outlook 2007)

Outlook.MAPIFolder oFolderInbox =
oNameSpace.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
Outlook.Explorer oExplorerInbox =
applicationObject.Explorers.Add(oFolderInbox,
Outlook.OlFolderDisplayMode.olFolderDisplayNoNavigation);

oExplorerInbox.Search(entertxt,
Outlook.OlSearchScope.olSearchScopeCurrentFolder);
oExplorerInbox.ShowPane(Outlook.OlPane.olOutlookBar, true);
oExplorerInbox.Display();

This code is work as search result display on outlook explore. But same code
is not working Microsoft outlook 11.0 Library 9.2 (outlook 2003).



Ken Slovak - said:
If you want anything else you'd have to construct the display dialog from
scratch. For example a form with a grid control listing all the returns from
your search that you populate from scratch by iterating the Results
collection when AdvancedSearchComplete() fires.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


mithilesh said:
Hi,

I'm trying to use outlook 2003 plug in application advancedSearch method
to
search on
multiple public, inbox with sub folders and than display the results on
outlook windows.

I encountered several problems in the process:

1) display: Enter the search key in txt box and click the Ok
button(plug-in
tool on outlook toolbar ) . Search result will be display on outlook
explore.


The only method I could find to display to results was using a save
method.

Any suggestion and a specily code samples would be helpful.
 
M

mithilesh

Advanced Search: Advanced Search have any method for n number of time search
mail with different key word and save on same folder name.

Public folder: thought MAPI, I able to access Public folder name only but I
want to apply Advanced Search method for search mail and n number of time
search with different key word and save on same folder name.
 
S

Sue Mosher [MVP-Outlook]

You can use the AdvancedSearch method on any single public folder. The Search.Save method saves the search as a search folder.

Sorry, but if there's another question here, I don't understand it.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


mithilesh said:
Advanced Search: Advanced Search have any method for n number of time search
mail with different key word and save on same folder name.

Public folder: thought MAPI, I able to access Public folder name only but I
want to apply Advanced Search method for search mail and n number of time
search with different key word and save on same folder name.



Sue Mosher said:
My main purpose is search result display on outlook explore.
oExplorerInbox.Search(entertxt,
Outlook.OlSearchScope.olSearchScopeCurrentFolder);
oExplorerInbox.ShowPane(Outlook.OlPane.olOutlookBar, true);
oExplorerInbox.Display();

The Explorer.Search method is supported only in Outlook 2007, not earlier versions.

In Outlook 2003, you could call Application.AdvancedSearch, save the search as a search folder, then display that folder. Or, do as Ken suggested and build your own display form.

mithilesh said:
Thanks Mr. Ken Slovak.
Using Microsoft outlook 12.0 Library 9.3 (outlook 2007)

Outlook.MAPIFolder oFolderInbox =
oNameSpace.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
Outlook.Explorer oExplorerInbox =
applicationObject.Explorers.Add(oFolderInbox,
Outlook.OlFolderDisplayMode.olFolderDisplayNoNavigation);

oExplorerInbox.Search(entertxt,
Outlook.OlSearchScope.olSearchScopeCurrentFolder);
oExplorerInbox.ShowPane(Outlook.OlPane.olOutlookBar, true);
oExplorerInbox.Display();

This code is work as search result display on outlook explore. But same code
is not working Microsoft outlook 11.0 Library 9.2 (outlook 2003).



:

If you want anything else you'd have to construct the display dialog from
scratch. For example a form with a grid control listing all the returns from
your search that you populate from scratch by iterating the Results
collection when AdvancedSearchComplete() fires.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


Hi,

I'm trying to use outlook 2003 plug in application advancedSearch method
to
search on
multiple public, inbox with sub folders and than display the results on
outlook windows.

I encountered several problems in the process:

1) display: Enter the search key in txt box and click the Ok
button(plug-in
tool on outlook toolbar ) . Search result will be display on outlook
explore.


The only method I could find to display to results was using a save
method.

Any suggestion and a specily code samples would be helpful.
 
M

mithilesh

Sorry.
Developing searching functionalty as look like outlook search but it’s
customize for our specific requirement.

entertxt1 = commandBarComboBox.Text;
Outlook.NameSpace mapiNamespace = applicationObject.GetNamespace("MAPI");
Outlook.MAPIFolder oPublicFolders=
mapiNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olPublicFoldersAllPublicFolders );

string scope = oPublicFolders.Name;
foreach (MAPIFolder opublic in oPublicFolders.Folders )
{
if (opublic.Name == "A_Public")
{
scope = opublic.Name;
}
}
string filter = "\"http://schemas.microsoft.com/mapi/proptag/0x001a001e\"
LIKE 'IPM.Note%'";

filter = filter + " AND urn:schemas:httpmail:subject LIKE '%" + entertxt1 +
"%'";

bool searchSubFolders = false;

Outlook.Search search = applicationObject.AdvancedSearch(scope, filter,
searchSubFolders, System.Reflection.Missing.Value);
MessageBox.Show(scope, " Search Complite ");
Outlook.MAPIFolder resultsFolder = search.Save("serach13");
search.Display();

Here, the search.Save("serach13") method was not saves the search as a
search folder and MessageBox also not showing. when maked comment line-

//Outlook.Search search

Then MessageBox is show.

Have any error, apply the AdvancedSearch method on single public folder?
search.Save("serach13") ,folder want to reuse for n number time of search
with different search key word.
 
S

Sue Mosher [MVP-Outlook]

I may be mistaken about being able to create a search folder from a public folder. Can you create one manually?

Also, this statement isn't going to work:

scope = opublic.Name;

For a non-default folder, the scope needs to be a full path string, enclosed in quotation marks.

And this statement isn't valid at all:

search.Display();

In any case, there really isn't much point in creating search folders from public folders. The utility of search folders is that they can search across folders. That, of course, is not possible with public folders. Therefore, you might as well create custom, filtered views. In Outlook 2003, that means working with the <filter> element of the View.XML property.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
K

Ken Slovak - [MVP - Outlook]

Public folders don't support search folders, the store provider doesn't
support it. The IMsgStore property PR_STORE_SUPPORT_MASK doesn't have the
flag set for STORE_SEARCH_OK.




I may be mistaken about being able to create a search folder from a public
folder. Can you create one manually?

Also, this statement isn't going to work:

scope = opublic.Name;

For a non-default folder, the scope needs to be a full path string, enclosed
in quotation marks.

And this statement isn't valid at all:

search.Display();

In any case, there really isn't much point in creating search folders from
public folders. The utility of search folders is that they can search across
folders. That, of course, is not possible with public folders. Therefore,
you might as well create custom, filtered views. In Outlook 2003, that means
working with the <filter> element of the View.XML property.
 
S

Sue Mosher [MVP-Outlook]

Thanks for confirming that, Ken.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


Ken Slovak - said:
Public folders don't support search folders, the store provider doesn't
support it. The IMsgStore property PR_STORE_SUPPORT_MASK doesn't have the
flag set for STORE_SEARCH_OK.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


I may be mistaken about being able to create a search folder from a public
folder. Can you create one manually?

In any case, there really isn't much point in creating search folders from
public folders. The utility of search folders is that they can search across
folders. That, of course, is not possible with public folders. Therefore,
you might as well create custom, filtered views. In Outlook 2003, that means
working with the <filter> element of the View.XML property.
 
M

mithilesh

Outlook 2003 utility, search public folders can do the search and display
result.

Though MAPI, The AdvancedSearch method can do search in inbox/outbox and
display the results folder by Display method. AdvancedSearch with public
folder can’t do the same job?

I posted on 1/30/2008 in same thread.
Outlook 2007, Search and display result was done. But Explorer.Search method
is supported only in Outlook 2007, not earlier versions.

The main Purpose is, to display the search results on Outlook Explorer from
public/Inbox folders.

Give any suggestion about search, can apply in both Outlook versions.
 
S

Sue Mosher [MVP-Outlook]

Please reread my earlier post. As you've already been told, there is no Display method related to the AdvancedSearch method or the Search object. The solution in a public folder is to use filtered views.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 

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