Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LDAP Query String to determine the mailing list

Status
Not open for further replies.

cplsplsprogrammer

Programmer
Apr 18, 2005
42
US
Hello All,

I am trying to write a program to get a list of all the customer recepients in my exchange server. I was able to query LDAP and the query I am using is

(|(ObjectClass=organizationalPerson)(ObjectClass=groupOfNames))

It is giving me all the mailboxes and the distribution lists. Can anyone tell me how can i distinguish if it is mailbox or a distribution list?

Thanks,
Ram
 
I am doing this using C#. Sorry my query is

<LDAP://{0}/{1}>;{2};name,mail,sn,givenName,initials,Company,adspath,rdn;subtree
 
>...how can i distinguish if it is mailbox or a distribution list?

Just check its class property? In vb(s) it is like this, all to lowercase (lcase) for convenience.
[tt]
select case lcase(obj.class)
case "mailbox"
'do something
case "distribution-list"
'do some other thing
case else
'do some more other thing
end select
[/tt]
In c# it would be something like switch(...) {case "mailbox": ... break; case ... break;...} structure?

- tsuji
 
Corrections:

"mailbox" and "distribution-list", I meant for "organizationalperson" and "groupofnames" via LDAP, as shown in the query.

- tsuji
 
Hello tsuji,

Thank you for writting about the mailbox and distirbution-list. Can you please tell me how to write a LDAP query to query the GAL (global address list), like what would be my cn, ou, o values? what i have now is querying just one domain in the GAL. below is my query and ou, o values.....

"cn=recipients,ou=<domain name>,o=<organization name>";

("(|(ObjectClass=organizationalPerson)(ObjectClass=groupOfNames))")
<LDAP://{0}/{1}>;{2};name,mail,sn,givenName,initials,Company,adspath,rdn;subtree


My other question is what would be my query to search for a particular distribution list in the GAL?

Do you know of any resources where I can read from or help me in writting LDAP queries?

Thanks,
Ram

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top