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

Tags: , , , , ,

Getting details of a person in GAL on Exchange by its alias





 
 
Thread Tools Display Modes
  #1  
Old February 23rd 07, 09:49 AM posted to microsoft.public.outlook.program_vba
Petr Bazant
external usenet poster
 
Posts: 2
Default Getting details of a person in GAL on Exchange by its alias

Hello, I have an alias of a person listed in GAL (on Exchange server)
and I would like to obtain programatically its details, like email,
name etc. The alias is stored as the value of field "Item12" but it
always returns an error E_ACCESSDENIED. Is there a way how to do it?

Set objSession = CreateObject("MAPI.Session")
objSession.Logon (g_strMAPILogOn)
Set MyAddressList = objSession.AddressLists(g_strAddressList)
Set MyAddressEntries = MyAddressList.AddressEntries

For Each SomeEntry In MyAddressEntries
Set MyEntry = SomeEntry
If alias = MyEntry.Fields("Item 12").Value Then
...
...
End If
Next


Thank you, Petr

Ads
  #2  
Old February 23rd 07, 11:13 AM posted to microsoft.public.outlook.program_vba
Petr Bazant
external usenet poster
 
Posts: 2
Default Getting details of a person in GAL on Exchange by its alias

If someone has same problem I found a solution (almost everything was
already answered in this newsgroup). Thanks to everyone.

Type Ohlasovatel
jmeno As String
email As String
End Type

Public Function GetOhlasovatelDetails(ByVal alias As String) As
Ohlasovatel
Dim objSession As MAPI.Session
Dim objField As MAPI.Field
Dim MyAddressList As MAPI.AddressList
Dim MyAddressEntries As MAPI.AddressEntries
Dim MyEntry As MAPI.AddressEntry
Dim SomeEntry As MAPI.AddressEntry
Dim MyRecipient As MAPI.Recipient
Dim v As Variant
Dim strReturnValue As String
Dim jjmeno As String
Dim eemail As String

Set objSession = CreateObject("MAPI.Session")
objSession.Logon (g_strMAPILogOn)
Set MyAddressList = objSession.AddressLists(g_strAddressList)
Set MyAddressEntries = MyAddressList.AddressEntries

For Each SomeEntry In MyAddressEntries
Set MyEntry = SomeEntry
Set objField = MyEntry.Fields(CdoPR_EMS_AB_PROXY_ADDRESSES)
If MyEntry.Fields(CdoPR_ACCOUNT) = alias Then
jjmeno = MyEntry.Name
For Each v In objField.Value
If InStr(1, UCase(v), g_strEMailAddressIdentifier)
Then
eemail = Mid(v, 6, 256)
GetOhlasovatelDetails.jmeno = jjmeno
GetOhlasovatelDetails.email = eemail
Exit Function
End If
Next 'Field Value
End If
Next 'Address Entry
End Function


Petr Bazant napsal:
Hello, I have an alias of a person listed in GAL (on Exchange server)
and I would like to obtain programatically its details, like email,
name etc. The alias is stored as the value of field "Item12" but it
always returns an error E_ACCESSDENIED. Is there a way how to do it?

Set objSession = CreateObject("MAPI.Session")
objSession.Logon (g_strMAPILogOn)
Set MyAddressList = objSession.AddressLists(g_strAddressList)
Set MyAddressEntries = MyAddressList.AddressEntries

For Each SomeEntry In MyAddressEntries
Set MyEntry = SomeEntry
If alias = MyEntry.Fields("Item 12").Value Then
...
...
End If
Next


Thank you, Petr


 




Thread Tools
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
Can meeting requests only come from same GAL or Exchange Server DallyLab Outlook - Calandaring 3 February 22nd 07 10:03 PM
Allow users to maintain contact details in GAL DI-Tex Outlook - Using Contacts 1 October 18th 06 03:46 PM
Outlook contacts to Exchange GAL Sam Giraffe Outlook - Using Contacts 0 August 28th 06 07:24 PM
In Exchange calendar show name of person who scheduled meeting Barbsboys2 Outlook - Calandaring 3 February 18th 06 08:51 PM
Exchange GAL in Outlook using POP3 Rich In NC Outlook - Using Contacts 1 February 8th 06 04:56 AM


All times are GMT +1. The time now is 04:36 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Mortgages - Mortgages - Debt Consolidation - Loans - Psychic Readings