Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / September 2005

Tip: Looking for answers? Try searching our database.

Automate opening outlook and finding contact

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bgcpen - 22 Sep 2005 16:05 GMT
hello, i have an access database that finds an outlook contact alias. (ex.
ABCDE)  Is there any way i can have access search the contacts and return the
contact full name?   I don't know if there is a way to open outlook, open
address book, search by alias and return contact full name.    So for
example, the database returns ABCJD - opens outlook, opens address book,
searches for alias ABCJD and returns full name John Doe.

Is it possible?
David C. Holley - 22 Sep 2005 16:56 GMT
YES. This should get you started, however there isn't an ALIAS property
for ContactItems listed in the Outlook Object Model/Outlook Help. Which
property where you referring to? (The code below only looks in the
default Contact folder. I'm checking on how to loop through all folders.)

Sub snoopContacts(strContact As String)

    Dim objOutlook As Outlook.Application
    Dim nms As Outlook.NameSpace
    Dim targetFolder As Outlook.MAPIFolder
    Dim targetItems As Outlook.Items
    Dim targetContact As Outlook.ContactItem
    Dim strFilter As String

    Set objOutlook = CreateObject("Outlook.application")
    Set nms = objOutlook.GetNamespace("MAPI")
    Set targetFolder = nms.GetDefaultFolder(olFolderContacts)

    'The [] around the property are required
    'Not all ContactItems will have a FullName and example would be
    'if you have a Company listed in your contacts where the company
    'name is listed in the COMPANY field, but no FIRST/LAST Name is
    'provided
    strFilter = "[FullName]=" & Chr(34) & strContact & Chr(34)
    Set targetItems = targetFolder.Items.Restrict(strFilter)

    Debug.Print targetItems.Count

    Stop

    Set targetItems = Nothing
    Set targetFolder = Nothing
    Set nms = Nothing
    Set objOutlook = Nothing

End Sub

> hello, i have an access database that finds an outlook contact alias. (ex.
> ABCDE)  Is there any way i can have access search the contacts and return the
[quoted text clipped - 4 lines]
>
> Is it possible?
bgcpen - 27 Sep 2005 21:11 GMT
Thanks for the response. Sorry about the lateness, i've been away.
2 things i need to add.  First, the string being searched for is being found
by a query in a calculated field. It is not stored anywhere. I'm not sure if
the code below reflects that.  How would you pass the value from the access
query to the code?

Second, i'm guessing the alias field is called the "NickName" field in the
outlook object model.  That's the closest thing i could find to alias.
Any more help would be greatly appreciated.

Thanks

> YES. This should get you started, however there isn't an ALIAS property
> for ContactItems listed in the Outlook Object Model/Outlook Help. Which
[quoted text clipped - 41 lines]
> >
> > Is it possible?
David C. Holley - 28 Sep 2005 01:07 GMT
First, you need to confirm for certain that "NickName" is the field to
search. Doesn't help to search your daughter's dresser for your son't
baseball bat.

> Thanks for the response. Sorry about the lateness, i've been away.
> 2 things i need to add.  First, the string being searched for is being found
[quoted text clipped - 53 lines]
>>>
>>>Is it possible?
bgcpen - 28 Sep 2005 15:30 GMT
Well, the value that i would be looking for (ex. ROSPL)  is listed in the
"alias" field when the address book is open.  If i try to search the address
book through the outlook search bar, it comes up.   If i open the address
book and type in the value in the "type name or select from list" field, it
does not find it.

I'm not sure if there's any way to completely verify the exact field name i
am looking for.

> First, you need to confirm for certain that "NickName" is the field to
> search. Doesn't help to search your daughter's dresser for your son't
[quoted text clipped - 57 lines]
> >>>
> >>>Is it possible?
David C. Holley - 28 Sep 2005 15:44 GMT
Unfortunately, the only techniques that I know rely on knowning exactly
in which field the value lies. How are the Contacts originally created
via code or manually entered? If its by code, do you have access to it
as the code would reveal which field we're dealing with.

> Well, the value that i would be looking for (ex. ROSPL)  is listed in the
> "alias" field when the address book is open.  If i try to search the address
[quoted text clipped - 66 lines]
>>>>>
>>>>>Is it possible?
bgcpen - 28 Sep 2005 16:19 GMT
The contacts are in the global address book on an exchange server. I have no
access to them.  I'm not sure how they were created either.  I guess i will
keep trying to research it. Thanks for your help!

> Unfortunately, the only techniques that I know rely on knowning exactly
> in which field the value lies. How are the Contacts originally created
[quoted text clipped - 71 lines]
> >>>>>
> >>>>>Is it possible?
David C. Holley - 28 Sep 2005 19:39 GMT
The GAL changes everthing. I was assuming that you were searching your
private Contacts folder. Post the message here:

microsoft.public.outlook.program_vba

They'll be able to answer the question.

> The contacts are in the global address book on an exchange server. I have no
> access to them.  I'm not sure how they were created either.  I guess i will
[quoted text clipped - 75 lines]
>>>>>>>
>>>>>>>Is it possible?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.