PC Review


Reply
Thread Tools Rate Thread

AdvancedSearch Method in Exchange Server environment

 
 
=?Utf-8?B?SG93YXJk?=
Guest
Posts: n/a
 
      20th Apr 2006
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
 
Reply With Quote
 
 
 
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      21st Apr 2006
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" <(E-Mail Removed)> wrote in message
news:836FBD0B-9982-4735-9FAB-(E-Mail Removed)...
> 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


 
Reply With Quote
 
=?Utf-8?B?SG93YXJk?=
Guest
Posts: n/a
 
      21st Apr 2006
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" <(E-Mail Removed)> wrote in message
> news:836FBD0B-9982-4735-9FAB-(E-Mail Removed)...
> > 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

>
>

 
Reply With Quote
 
=?Utf-8?B?SG93YXJk?=
Guest
Posts: n/a
 
      21st Apr 2006
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" <(E-Mail Removed)> wrote in message
> > news:836FBD0B-9982-4735-9FAB-(E-Mail Removed)...
> > > 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

> >
> >

 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      24th Apr 2006
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" <(E-Mail Removed)> wrote in message
news:C08FF2BC-D91F-4382-8629-(E-Mail Removed)...
> 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.


 
Reply With Quote
 
=?Utf-8?B?SG93YXJk?=
Guest
Posts: n/a
 
      26th Apr 2006
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" <(E-Mail Removed)> wrote in message
> news:C08FF2BC-D91F-4382-8629-(E-Mail Removed)...
> > 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.

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with AdvancedSearch method Chris O''''Neill Microsoft Outlook VBA Programming 15 7th Aug 2008 02:11 PM
Connecting to the exchange server in a wireless environment Chris Bonneu Microsoft Outlook Installation 1 31st Jul 2008 09:37 AM
Re: AdvancedSearch Method Ken Slovak - [MVP - Outlook] Microsoft Outlook VBA Programming 1 7th Dec 2006 11:02 PM
How do I send a Fax in an Exchange Server environment? Chris Microsoft Outlook Discussion 1 21st Nov 2006 08:37 AM
Exchange Server Environment =?Utf-8?B?U3dhbnNvbmc=?= Microsoft Outlook BCM 1 14th Nov 2006 06:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:50 AM.