Check if current user belongs to a distribution list

Y

Yahya Saad

Dear Sirs,

How can I check if the current user belongs to a distribution list
existing on the global address list.

Regards,
Yahya
 
D

Dmitry Streblechenko \(MVP\)

Extended MAPI only - open the PR_EMS_AB_IS_MEMBER_OF_DL property as
IMAPITable to list all DLs the the given user belongs to.
Otherwise loop through the DL members and compare the user's entry id with
the entry ids of all DL members.

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

Dmitry Streblechenko \(MVP\)

Then you will need to loop through all DL members and compare the entry ids
with the entry id of a given recipient.

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

Yahya Saad

How can I reference the Distribution Lists in the Global Address List?

Thank you,
Yahya
 
D

Dmitry Streblechenko \(MVP\)

By name (AddressList.AddressEntries.Item('the name")) or by an index. For a
given address entry, check the AddressEntry.Members collection. It will be
NULL if the address entry is not a DL.

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

Karl Timmermans

This is not meant to contradict Dmitry's answer in any way (it's completely
correct) but rather add a higher level verification to an entry -

You should first check the AddressEntry.DisplayType to see if it is of type
olDistList (value = 1) first (there are other values to this but have as yet
to have someone tell me or encounter where these would be used within the
GAL) . That would indicate that this is a Global Distribution Group with no
members if AddressEntry.Members is null (or Nothing). At the same time, you
should also take into account that Distribution Groups can also have
<embedded> distribution groups so you should allow for that possibility.

The only validation we've seen so far is that you cannot include a GDG that
references itself but child references may well include references to a
global parent (in effect causing a very large circular reference if you are
traversing the tree - not a major issue in normal cases).

Karl
 

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