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

Search in GAL from another office application



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 7th 06, 03:35 AM posted to microsoft.public.outlook.program_vba
PaCoCourt
external usenet poster
 
Posts: 2
Default Search in GAL from another office application

Hi,
From xls, i'm trying to retrieve information (like mail, phone, ...) from
other colleagues. Idealy, the code must make a search in GAL. As, there are
thousands of entries looping through is verry time consumming.
Question
Is it possible to activate the search in GAL from xls or may be another
solution.
tks
P.
  #2  
Old July 7th 06, 08:26 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Search in GAL from another office application

Try the macros below in an Excel spreadsheet. Make sure you set a reference
to the Microsoft Collaboration Data Objects 1.21 library, and ensure that
Outlook is open. The code demonstrates searching the GAL for a particular
user name; all user details are output to the Immediate window.

Sub TestGetGALAddressDetails()
GetGALAddressDetails "John Doe"
End Sub

Sub GetGALAddressDetails(UserFullName As String)
On Error Resume Next

Dim objSession As New MAPI.Session
Dim objAdds As MAPI.AddressLists
Dim objAddress As MAPI.AddressEntry
Dim objGAL As MAPI.AddressList
Dim objFields As MAPI.Fields, objField As MAPI.Field

objSession.Logon , , , False

If objSession Is Nothing Then Exit Sub

Set objAdds = objSession.AddressLists
Set objGAL = objAdds.Item("Global Address List")
For Each objAddress In objGAL.AddressEntries
If objAddress.DisplayType = CdoUser Or objAddress.DisplayType =
CdoRemoteUser Then
If InStr(objAddress.Name, UserFullName) 0 Then
Debug.Print "Name: " & objAddress.Name
Set objField = objAddress.Fields(CdoPR_BUSINESS_ADDRESS_CITY)
If Not objField Is Nothing Then Debug.Print objField.Value:
Set objField = Nothing
Set objField =
objAddress.Fields(CdoPR_BUSINESS_ADDRESS_COUNTRY)
If Not objField Is Nothing Then Debug.Print objField.Value:
Set objField = Nothing
Set objField =
objAddress.Fields(CdoPR_BUSINESS_ADDRESS_POSTAL_CO DE)
If Not objField Is Nothing Then Debug.Print objField.Value:
Set objField = Nothing
Set objField =
objAddress.Fields(CdoPR_BUSINESS_ADDRESS_STATE_OR_ PROVINCE)
If Not objField Is Nothing Then Debug.Print objField.Value:
Set objField = Nothing
Set objField =
objAddress.Fields(CdoPR_BUSINESS_ADDRESS_STREET)
If Not objField Is Nothing Then Debug.Print objField.Value:
Set objField = Nothing
Set objField = objAddress.Fields(CdoPR_TITLE)
If Not objField Is Nothing Then Debug.Print objField.Value:
Set objField = Nothing
Set objField = objAddress.Fields(CdoPR_COMPANY_NAME)
If Not objField Is Nothing Then Debug.Print objField.Value:
Set objField = Nothing
Set objField = objAddress.Fields(CdoPR_DEPARTMENT_NAME)
If Not objField Is Nothing Then Debug.Print objField.Value:
Set objField = Nothing
Set objField = objAddress.Fields(CdoPR_OFFICE_LOCATION)
If Not objField Is Nothing Then Debug.Print objField.Value:
Set objField = Nothing
Set objField = objAddress.Fields(CdoPR_ASSISTANT)
If Not objField Is Nothing Then Debug.Print objField.Value:
Set objField = Nothing
Set objField =
objAddress.Fields(CdoPR_BUSINESS_TELEPHONE_NUMBER)
If Not objField Is Nothing Then Debug.Print objField.Value:
Set objField = Nothing
End If
End If
Next

objSession.Logoff

Set objSession = Nothing
Set objAdds = Nothing
Set objAddress = Nothing
Set objGAL = Nothing
Set objFields = Nothing
Set objField = Nothing
End Sub

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"PaCoCourt" wrote:

Hi,
From xls, i'm trying to retrieve information (like mail, phone, ...) from
other colleagues. Idealy, the code must make a search in GAL. As, there are
thousands of entries looping through is verry time consumming.
Question
Is it possible to activate the search in GAL from xls or may be another
solution.
tks
P.

  #3  
Old September 1st 06, 11:07 AM posted to microsoft.public.outlook.program_vba
PaCoCourt
external usenet poster
 
Posts: 2
Default Search in GAL from another office application

Tks for your answer. (could you apologize to react so late, due to vacation).
Proposed code resolve the problem but it's slow (3 to 4 sec.). Is it a way
to enhance reponse time ?

"PaCoCourt" wrote:

Hi,
From xls, i'm trying to retrieve information (like mail, phone, ...) from
other colleagues. Idealy, the code must make a search in GAL. As, there are
thousands of entries looping through is verry time consumming.
Question
Is it possible to activate the search in GAL from xls or may be another
solution.
tks
P.

  #4  
Old September 1st 06, 05:16 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Search in GAL from another office application

I'd say 3-4 secs for looking through thousands of entries in your GAL is
quite acceptable.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"PaCoCourt" wrote:

Tks for your answer. (could you apologize to react so late, due to vacation).
Proposed code resolve the problem but it's slow (3 to 4 sec.). Is it a way
to enhance reponse time ?

"PaCoCourt" wrote:

Hi,
From xls, i'm trying to retrieve information (like mail, phone, ...) from
other colleagues. Idealy, the code must make a search in GAL. As, there are
thousands of entries looping through is verry time consumming.
Question
Is it possible to activate the search in GAL from xls or may be another
solution.
tks
P.

 




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
Index Search Refuses to search after MANY days of indexing--pls he JAYBO Outlook - Installation 5 June 15th 06 08:55 AM
What does outlook search when you search Contacts ? [email protected] Outlook - General Queries 0 May 1st 06 08:51 PM
GAL and OE Syed Khairuddin Outlook - General Queries 2 March 30th 06 04:14 PM
GAL autocomplete scartlidge Outlook - Using Contacts 0 February 15th 06 04:53 PM
Office 2003 AND Office XP - aka Office 2002 rrose selavy Outlook - General Queries 3 January 14th 06 11:14 AM


All times are GMT +1. The time now is 01:11 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.