How to obtain the Distribution List of a Sender

A

Alberto

Hello,

I'd like to know if it's possible to find if the sender of a mail over
Exchange server is a member of an specific Distribution List (in Exchange) so
this mail can be automatically marked. In other words, i´d like to konw if i
can acces the organizational address book. I'm afraid no but i ask here to
confirm it.

I'm using Outlook 2003. If i used Outlook 2007 would it be possible?

The solution should't show any prompts because a macro has to do this job on
the Inbox folder automatically.

Lot of thanks,

Alberto.
 
K

Ken Slovak - [MVP - Outlook]

The GAL (Global Address List) is available as one of the members of the
AddressLists collection. You can iterate that collection to find the GAL or
ask for it directly using the Item member of the collection. Once you have
that AddressList you can get its AddressEntries collection and iterate that
to get a specific DL and then get its members.

That will work in Outlook 2003.
 
A

Alberto

Thanks Ken,

it really helps me, I can read the members of a DL but the other way would
be esaier for me, I mean, to obtain the DLs a sernder of a mail is member
of through the GAL. I'm afraid this way is not possible with only de VBA
object model.

Alberto
 
K

Ken Slovak - [MVP - Outlook]

VBA is irrelevant, it would be the same with VB6, VB.NET, C# or any other
language. The limitations are what's available in the Outlook object model.
Even other lower level API's wouldn't let you query which DL's a person
belongs to, perhaps an LDAP query might do that. That I'm not sure of, I
rarely use LDAP.
 
D

Dmitry Streblechenko

Actually on the MAPI level, PR_EMS_AB_IS_MEMBER_OF_DL property can be
retrieved as IMAPITable. It will list all the DLs that the giveb user is a
member of.
<plug>
Redemption exposes PR_EMS_AB_IS_MEMBER_OF_DL as
theRDOAddressEntry.IsMemberOfDL property -
http://www.dimastr.com/redemption/rdo/RDOAddressEntry.htm

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set AddressEntry = Session.AddressBook.GAL.ResolveName("dmitry")
Debug.Print "-- Delegates (who can send of behalf of " & AddressEntry.Name
& ")"
for each AE in AddressEntry.Delegates
Debug.Print AE.Name
next
Debug.Print "-- Is delegate for (can send on behalf of these users)"
for each AE in AddressEntry.IsDelegateFor
Debug.Print AE.Name
next
Debug.Print "-- Is member of the following Dist Lists:"
for each AE in AddressEntry.IsMemberOfDL
Debug.Print AE.Name
next
Debug.Print "-- The following users report to " & AddressEntry.Name
for each AE in AddressEntry.Reports
Debug.Print AE.Name
next

</plug>

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 

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