Outlook - find word(s) in contacts

D

Daniel Kim

Hello,

I'm trying to automate the process of "Tools>Find>[searchstring]" in the
Contacts Folder, so that the user gets to select the contact that he/she
wants...

The only "Find" method I found returns the items one at a time, which is not
what I want. I want to basically simulate Tools>Find>[searchstring] (where
searchstring is provided by me)...

Outlook doesn't really provide a "Record Macro" functionality, so I'm having
a hard time finding what is going on underneath...

Can anyone help?

--Daniel
 
W

Wei-Dong Xu [MSFT]

Hi Daniel,

From my understanding to your issue, the KB article 294457 may provide some assistance for your on this issue. Please go to:
294457 OL2002: How to Programmatically Search a Folder Tree
http://support.microsoft.com/?id=294457

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
D

Daniel Kim

Well, I already saw that article, and it seems like in Outlook automation,
you only get the results of the search in the form of a collection... But I
was wondering if you could pretty much "simulate" a "Find" as it is done by
a live user. In other words, when you follow the directions for
"programmatically searching a folder tree", you get the results back
programatically, and you need to then cycle through each item
programatically. What I want is to simply display the Outlook Contacts
folder as if someone typed "A" on the "Find" edit box and pressed "search" -
in which case the Contact folder would display all the names with "A" in it.
There must be a way to "simulate" a button press??

--Daniel


Wei-Dong Xu said:
Hi Daniel,

From my understanding to your issue, the KB article 294457 may provide
some assistance for your on this issue. Please go to:
294457 OL2002: How to Programmatically Search a Folder Tree
http://support.microsoft.com/?id=294457

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Daniel Kim" <[email protected]>
Subject: Outlook - find word(s) in contacts
Date: Sat, 18 Oct 2003 01:10:56 -0700
Lines: 18
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <[email protected]>
Newsgroups: microsoft.public.office.developer.automation
NNTP-Posting-Host: adsl-66-125-173-240.dsl.snfc21.pacbell.net 66.125.173.240
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.office.developer.automation:7690
X-Tomcat-NG: microsoft.public.office.developer.automation

Hello,

I'm trying to automate the process of "Tools>Find>[searchstring]" in the
Contacts Folder, so that the user gets to select the contact that he/she
wants...

The only "Find" method I found returns the items one at a time, which is not
what I want. I want to basically simulate Tools>Find>[searchstring] (where
searchstring is provided by me)...

Outlook doesn't really provide a "Record Macro" functionality, so I'm having
a hard time finding what is going on underneath...

Can anyone help?

--Daniel
 
W

Wei-Dong Xu [MSFT]

Hi Daniel,

Thank you for replying and the detailed information about the issue!

According your scenario, I'd suggest you can begin with the code below to implement your own find function. These codes first get the contacts
folders and then search the last name of all items to pick up the one whose first letter of the last name is equal to "H". In this way, you can
search out all the items you specify very easily. I think these codes can make you very simple to extend the search function with the help of VBA.
I list the codes below:
------
Sub Find()
Dim fd As MAPIFolder
Set fd = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts)
Dim o As ContactItem
For Each obj In fd.Items
Set o = obj
If UCase(Left(o.LastName, 1)) = "H" Then
MsgBox o.LastNameAndFirstName
End If
Next
End Sub
------
Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Daniel Kim" <[email protected]>
References: <[email protected]> <[email protected]>
Subject: Re: Outlook - find word(s) in contacts
Date: Mon, 20 Oct 2003 14:23:02 -0700
Lines: 75
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <[email protected]>
Newsgroups: microsoft.public.office.developer.automation
NNTP-Posting-Host: adsl-64-160-49-120.dsl.snfc21.pacbell.net 64.160.49.120
Path: cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08.phx.gbl! TK2MSFTNGP10.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.office.developer.automation:7702
X-Tomcat-NG: microsoft.public.office.developer.automation

Well, I already saw that article, and it seems like in Outlook automation,
you only get the results of the search in the form of a collection... But I
was wondering if you could pretty much "simulate" a "Find" as it is done by
a live user. In other words, when you follow the directions for
"programmatically searching a folder tree", you get the results back
programatically, and you need to then cycle through each item
programatically. What I want is to simply display the Outlook Contacts
folder as if someone typed "A" on the "Find" edit box and pressed "search" -
in which case the Contact folder would display all the names with "A" in it.
There must be a way to "simulate" a button press??

--Daniel


Wei-Dong Xu said:
Hi Daniel,

From my understanding to your issue, the KB article 294457 may provide
some assistance for your on this issue. Please go to:
294457 OL2002: How to Programmatically Search a Folder Tree
http://support.microsoft.com/?id=294457

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Daniel Kim" <[email protected]>
Subject: Outlook - find word(s) in contacts
Date: Sat, 18 Oct 2003 01:10:56 -0700
Lines: 18
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <[email protected]>
Newsgroups: microsoft.public.office.developer.automation
NNTP-Posting-Host: adsl-66-125-173-240.dsl.snfc21.pacbell.net 66.125.173.240
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.office.developer.automation:7690
X-Tomcat-NG: microsoft.public.office.developer.automation

Hello,

I'm trying to automate the process of "Tools>Find>[searchstring]" in the
Contacts Folder, so that the user gets to select the contact that he/she
wants...

The only "Find" method I found returns the items one at a time, which is not
what I want. I want to basically simulate Tools>Find>[searchstring] (where
searchstring is provided by me)...

Outlook doesn't really provide a "Record Macro" functionality, so I'm having
a hard time finding what is going on underneath...

Can anyone help?

--Daniel
 
D

Daniel Kim

Thanks for the reply, but it doesn't really solve the problem I am having..

In the code below, I get back the results programatically, which means that
I need to then cycle through the results and display it (e.g., through
MsgBox)..

But the desired effect in my case is to display it within Outlook itself.
(very much like how Outlook displays a "subset" of the contacts in the
Contacts Folder if you do a simple search).

So the question is: can I display a subset of contacts in Outlook AS IF I
had done a "Simple Find" (Ctrl-E) using Outlook?

--Daniel



Wei-Dong Xu said:
Hi Daniel,

Thank you for replying and the detailed information about the issue!

According your scenario, I'd suggest you can begin with the code below to
implement your own find function. These codes first get the contacts
folders and then search the last name of all items to pick up the one
whose first letter of the last name is equal to "H". In this way, you can
search out all the items you specify very easily. I think these codes can
make you very simple to extend the search function with the help of VBA.
I list the codes below:
------
Sub Find()
Dim fd As MAPIFolder
Set fd = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts)
Dim o As ContactItem
For Each obj In fd.Items
Set o = obj
If UCase(Left(o.LastName, 1)) = "H" Then
MsgBox o.LastNameAndFirstName
End If
Next
End Sub
------
Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Subject: Re: Outlook - find word(s) in contacts
Date: Mon, 20 Oct 2003 14:23:02 -0700
Lines: 75
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <[email protected]>
Newsgroups: microsoft.public.office.developer.automation
NNTP-Posting-Host: adsl-64-160-49-120.dsl.snfc21.pacbell.net 64.160.49.120
Path:
cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA0
5.phx.gbl!TK2MSFTNGP08.phx.gbl!
TK2MSFTNGP10.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.office.developer.automation:7702
X-Tomcat-NG: microsoft.public.office.developer.automation

Well, I already saw that article, and it seems like in Outlook automation,
you only get the results of the search in the form of a collection... But I
was wondering if you could pretty much "simulate" a "Find" as it is done by
a live user. In other words, when you follow the directions for
"programmatically searching a folder tree", you get the results back
programatically, and you need to then cycle through each item
programatically. What I want is to simply display the Outlook Contacts
folder as if someone typed "A" on the "Find" edit box and pressed "search" -
in which case the Contact folder would display all the names with "A" in it.
There must be a way to "simulate" a button press??

--Daniel


Wei-Dong Xu said:
Hi Daniel,

From my understanding to your issue, the KB article 294457 may provide
some assistance for your on this issue. Please go to:
294457 OL2002: How to Programmatically Search a Folder Tree
http://support.microsoft.com/?id=294457

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Daniel Kim" <[email protected]>
Subject: Outlook - find word(s) in contacts
Date: Sat, 18 Oct 2003 01:10:56 -0700
Lines: 18
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <[email protected]>
Newsgroups: microsoft.public.office.developer.automation
NNTP-Posting-Host: adsl-66-125-173-240.dsl.snfc21.pacbell.net 66.125.173.240
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.office.developer.automation:7690
X-Tomcat-NG: microsoft.public.office.developer.automation

Hello,

I'm trying to automate the process of "Tools>Find>[searchstring]" in the
Contacts Folder, so that the user gets to select the contact that he/she
wants...

The only "Find" method I found returns the items one at a time, which
is
not
what I want. I want to basically simulate Tools>Find>[searchstring] (where
searchstring is provided by me)...

Outlook doesn't really provide a "Record Macro" functionality, so I'm having
a hard time finding what is going on underneath...

Can anyone help?

--Daniel
 
W

Wei-Dong Xu [MSFT]

Hi Daniel,

Thank you for replying!

In fact, the display of contact folder is a view to Outlook. Based on my experience, you can build one Filter for your searching rule. Then you can
apply the filter to the contact view, then you will get the filtered result.

Please feel free to let me know if you have any questions.

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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