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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I ask Exchange 5.5 a question? 1

Status
Not open for further replies.

tumblor

Technical User
Nov 14, 2001
7
US
I am sitting in an NT 4 environment with exchange 5.5 on the server. No active directory. Often times I get people requesting NT global groups to be setup, and they supply me with a Distribution List from exchange.

Is there any VBScript way to ask the Exchange server which users it has in any particular distribution list? Remember, I have no Active Directory to use (unfortunately)
 
There should be a way to enumerate the members of a DL with VBScript. Do a search for "email" related scripts in this forum and you'll find some examples that might help.

You might also want to post the same question in the Exchange 5.5 forum: forum10

Nathan aka: zaz (zaznet)
zaz@zaz.net
 
Hello tumblor,

To query distlist for a recipient, do something like this.
Code:
const olDistributionListItem=7
const olFolderContacts=10

dlnamespec="developers"    'your input distlist name
recipientspec="smithjohn"   'your input recipient name

set odl_id=nothing
set ool=createobject("outlook.application")
set ons=ool.getnamespace("MAPI")
ons.logon
set ocf=ons.getdefaultfolder(olFolderContacts)
for each odl in ocf.items.restrict("[MessageClass]=""IPM.DistList""")
    if lcase(odl.dlname)=dlnamespec then
        set odl_id=odl
        exit for
    end if
next
if (odl_id is nothing) then
    wscript.echo "Distlist is not found. Operation aborted"
    set ocf=nothing
    ons.logoff : set ons=nothing : set ool=nothing
    wscript.quit
end if

for i=1 to odl_id.membercount
    if strcomp(recipientname,odl_id.getmember(i).name,1)=0 then
        wscript.echo "Recipient found in the distlist."
    end if
next
ons.logoff
set odl_id=nothing : set ocf=nothing
set ons=nothing : set ool=nothing
wscript.echo "done"
regards - tsuji
 
- Corrections -

I should have made these changes.
[1] At the corresponding line, make rhs lcase as well, obviously.[tt]
if lcase(odl.dlname)=[red]lcase([/red]dlnamespec[red])[/red] then[/tt]
or equivalently[tt]
if strcomp(odl.dlname, dlnamespec,1)=0 then[/tt]

[2] At the corresponding lines, do this to make it more efficient.[tt]
if strcomp(recipientname,odl_id.getmember(i).name,1)=0 then
wscript.echo "Recipient found in the distlist."
[blue]exit for[/blue]
end if[/tt]

- tsuji

ps. Thanks, zaznet, for the vote.
 
Corrections...2:

Found another careless typos.
[3] recipientname should be recipientspec to be consistent.
[tt] if strcomp(recipient[red]spec[/red],odl_id.getmember(i).name,1)=0 then[/tt]

- tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top