How to get mail addresses of the user (SMTP-addresses)

  • Thread starter Thread starter derSchlichter
  • Start date Start date
D

derSchlichter

Hello,

I must find the following information out from a VB6-AddIn (Outloo
2000/XP/2003 - optional with Exchange or Standalone):

All SMTP-mail-addresses which the current user can access. Thi
includes his own addresses and the addresses of the users he is
representant of.

Up till now I work with this:


Code
-------------------

Set CurrentUser = MyOffice.GetNamespace("MAPI").CurrentUser
'
If Not CurrentUser Is Nothing Then
If CurrentUser.Address <> "Unknown" Then
If InStr(1, CurrentUser.Address, "/o=") > 0 Then
' EXCHANGE CONNECTED!!!
ID = CurrentUser.EntryID
Set objSession = CreateObject("MAPI.Session")
objSession.Logon "", "", False, False
Adresse = objSession.GetAddressEntry(ID).Fields(&H39FE001E).Value
ExName = objSession.GetAddressEntry(ID).Fields(&H3001001E).Value
Set objSession = Nothing
Else
' OUTLOOK STANDALONE!!!!!
Adresse = CurrentUser.Address
ExName = ""
End If
End If
End If
Set CurrentUser = Nothing

-------------------

I receive the SMTP address ([email protected]) in -Adresse- and unde
-ExName- the Exchange user name. Unfortunately, I receive no *mor
addresses* and also not *the representatives*. What else can I do?

Hope my english is not too bad to understand my question...

Volke
 
There's no one property that will give you what you want.

You need to get the user's entry in the GAL if they are using Exchange and
then harvest the email addresses from there, then see if there's a contact
record that represents the user and see the 3 possible email addresses in
the contact record. To get the SMTP equivalent address for an Exchange
distinguished name you can use the code sample at www.cdolive.com/cdo5.htm.

Then to see the delegate accesses available you would need to scan the
mailboxes on the Exchange server and look for delegate permissions for each
maibox and see if that user has permissions on that mailbox and what they
are.
 
Back
Top