A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

AdvancedSearch Method in Exchange Server environment



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 20th 06, 08:42 PM posted to microsoft.public.outlook.program_vba
Howard
external usenet poster
 
Posts: 23
Default AdvancedSearch Method in Exchange Server environment

Hello,

I'm trying to search messages in a series of shared inboxes based on various
criteria (for example, all messages whose subject contains the word "access").

I've defined my MAPI namespace and the specific folders/inboxes to search,
yet the only folder the AdvancedSearch method seems to look in is my personal
inbox, not the shared inboxes I'm specifying in the AdvancedSearch parameters.

Does this ring a bell with anyone?

Thanks,
Howard
Ads
  #2  
Old April 21st 06, 03:28 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default AdvancedSearch Method in Exchange Server environment

AdvancedSearch can only search in one mail store at a time.

--
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


"Howard" wrote in message
...
Hello,

I'm trying to search messages in a series of shared inboxes based on
various
criteria (for example, all messages whose subject contains the word
"access").

I've defined my MAPI namespace and the specific folders/inboxes to search,
yet the only folder the AdvancedSearch method seems to look in is my
personal
inbox, not the shared inboxes I'm specifying in the AdvancedSearch
parameters.

Does this ring a bell with anyone?

Thanks,
Howard


  #3  
Old April 21st 06, 05:01 PM posted to microsoft.public.outlook.program_vba
Howard
external usenet poster
 
Posts: 23
Default AdvancedSearch Method in Exchange Server environment

Understood. But how can I get it to search a mail store other than my own?
I've tried doing an Application.logon to a profile associated with one of the
shared inboxes I'm trying to search but the AdvancedSearch seems to go into
an endless loop.

"Ken Slovak - [MVP - Outlook]" wrote:

AdvancedSearch can only search in one mail store at a time.

--
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


"Howard" wrote in message
...
Hello,

I'm trying to search messages in a series of shared inboxes based on
various
criteria (for example, all messages whose subject contains the word
"access").

I've defined my MAPI namespace and the specific folders/inboxes to search,
yet the only folder the AdvancedSearch method seems to look in is my
personal
inbox, not the shared inboxes I'm specifying in the AdvancedSearch
parameters.

Does this ring a bell with anyone?

Thanks,
Howard



  #4  
Old April 21st 06, 08:51 PM posted to microsoft.public.outlook.program_vba
Howard
external usenet poster
 
Posts: 23
Default AdvancedSearch Method in Exchange Server environment

Okay, I've figured out how to get the AdvancedSearch function to work.
However, the Application_AdvancedSearchComplete event isn't firing, so the
search results aren't getting passed back to the calling subroutine. Can
anyone hazard a guess as to what I'm doing wrong?

"Howard" wrote:

Understood. But how can I get it to search a mail store other than my own?
I've tried doing an Application.logon to a profile associated with one of the
shared inboxes I'm trying to search but the AdvancedSearch seems to go into
an endless loop.

"Ken Slovak - [MVP - Outlook]" wrote:

AdvancedSearch can only search in one mail store at a time.

--
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


"Howard" wrote in message
...
Hello,

I'm trying to search messages in a series of shared inboxes based on
various
criteria (for example, all messages whose subject contains the word
"access").

I've defined my MAPI namespace and the specific folders/inboxes to search,
yet the only folder the AdvancedSearch method seems to look in is my
personal
inbox, not the shared inboxes I'm specifying in the AdvancedSearch
parameters.

Does this ring a bell with anyone?

Thanks,
Howard



  #5  
Old April 24th 06, 04:19 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default AdvancedSearch Method in Exchange Server environment

It works here.

Search code:

Sub SalesSearch()
Dim objSch As Search
Dim strF As String
Dim strS As String
Dim strTag As String

strF = Chr(34) & "urn:schemas:httpmail:subject" & Chr(34) & " LIKE
'%Order%'"

strS = "'//Mailbox - Sales'" 'search Sales mailbox and all subfolders

strTag = "DomainSearch"

Set objSch = Application.AdvancedSearch(Scope:=strS, Filter:=strF, _
SearchSubFolders:=True, Tag:=strTag)

Set objSch = Nothing
End Sub

Event handler:

Public Sub Application_AdvancedSearchComplete(ByVal SearchObject As Search)
Dim rsts As Outlook.Results

If (SearchObject.Tag = "DomainSearch") Then
Set rsts = SearchObject.Results
MsgBox "Search returned " & rsts.Count & " items"
End If

Set rsts = Nothing
End Sub

This was run in Outlook VBA. The event handler was placed in the
ThisOutlookSession class module, the search code was run from a code module.
It takes a bit of time for the search to complete, depending on subfolders
count and number of items, but it worked.

--
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


"Howard" wrote in message
...
Okay, I've figured out how to get the AdvancedSearch function to work.
However, the Application_AdvancedSearchComplete event isn't firing, so the
search results aren't getting passed back to the calling subroutine. Can
anyone hazard a guess as to what I'm doing wrong?

"Howard" wrote:

Understood. But how can I get it to search a mail store other than my
own?
I've tried doing an Application.logon to a profile associated with one of
the
shared inboxes I'm trying to search but the AdvancedSearch seems to go
into
an endless loop.


  #6  
Old April 26th 06, 07:55 PM posted to microsoft.public.outlook.program_vba
Howard
external usenet poster
 
Posts: 23
Default AdvancedSearch Method in Exchange Server environment

Ken,

That did the trick - my AdvancedSearchComplete event is firing accurately
and my Results object contains the correct data - thank you!

Here's what I was doing wrong: even though I was declaring my results object
publicly, I was setting its value in the class module that was calling the
AdvancedSearch method, rather than calling it from within the
AdvancedSearchComplete event code. Once I moved the line of code into that
module, I got the results I was expecting!

"Ken Slovak - [MVP - Outlook]" wrote:

It works here.

Search code:

Sub SalesSearch()
Dim objSch As Search
Dim strF As String
Dim strS As String
Dim strTag As String

strF = Chr(34) & "urn:schemas:httpmail:subject" & Chr(34) & " LIKE
'%Order%'"

strS = "'//Mailbox - Sales'" 'search Sales mailbox and all subfolders

strTag = "DomainSearch"

Set objSch = Application.AdvancedSearch(Scope:=strS, Filter:=strF, _
SearchSubFolders:=True, Tag:=strTag)

Set objSch = Nothing
End Sub

Event handler:

Public Sub Application_AdvancedSearchComplete(ByVal SearchObject As Search)
Dim rsts As Outlook.Results

If (SearchObject.Tag = "DomainSearch") Then
Set rsts = SearchObject.Results
MsgBox "Search returned " & rsts.Count & " items"
End If

Set rsts = Nothing
End Sub

This was run in Outlook VBA. The event handler was placed in the
ThisOutlookSession class module, the search code was run from a code module.
It takes a bit of time for the search to complete, depending on subfolders
count and number of items, but it worked.

--
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


"Howard" wrote in message
...
Okay, I've figured out how to get the AdvancedSearch function to work.
However, the Application_AdvancedSearchComplete event isn't firing, so the
search results aren't getting passed back to the calling subroutine. Can
anyone hazard a guess as to what I'm doing wrong?

"Howard" wrote:

Understood. But how can I get it to search a mail store other than my
own?
I've tried doing an Application.logon to a profile associated with one of
the
shared inboxes I'm trying to search but the AdvancedSearch seems to go
into
an endless loop.



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shared Contacts in exchange 2003 environment Joe Pena Outlook - Using Contacts 4 April 23rd 06 08:19 AM
Scripting Outlook in Exchange Environment Mr.Licon Outlook - Installation 1 March 28th 06 08:14 PM
unknown exception error in Exchange Environment Michael Anderson Outlook and VBA 3 February 28th 06 09:25 PM
how to get Exchange server? [email protected] Outlook and VBA 5 February 8th 06 06:37 PM
AdvancedSearch Serg Flic Outlook and VBA 1 January 10th 06 04:17 PM


All times are GMT +1. The time now is 11:51 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.