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!

Add user to Exchange 5.5 Dist Lis via script: Fail

Status
Not open for further replies.
Mar 26, 2003
9
GB
Hi,
I've got a vbs script to create an NT user and Exchange Mailbox.
Everything is working fine. e.g. the user and Mailbox are created. As
a next step, I then add the extra code to add a user to a Distribution
List. This is done from a checkbox on an asp form. It picks up the
correct checked box, binds in the the DL, but won't add it, giving
this error:

Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method: 'Add'
/addit55.asp, line 226

Line 226 being: "oDLObj.Add Mailbox.ADsPath"

I've done some response.writes and here is the output:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Setting Distribution List Memberships
DL Member Path: LDAP://Bones/cn=Walt
Disney,cn=Recipients,ou=Cemetary,o=BoneCollectors
ADsPath is: LDAP://Bones/cn=Recipients,ou=Cemetary,o=BoneCollectors
DistList: DL_3 (OfficeStaff)
ThisDL path: LDAP://Bones/cn=OfficeStaff,cn=Recipients,ou=Cemetary,o=BoneCollectors
Bound to DistList: LDAP://Bones/cn=OfficeStaff,cn=Recipients,ou=Cemetary,o=BoneCollectors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here is the relevant code in question:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Response.Write &quot;Setting Distribution List Memberships<BR>&quot;

ADsPath = &quot;LDAP://Bones/cn=Recipients,ou=Cemetary,o=BoneCollectors&quot;

Const DLCount = 4
DistListNames = Array (&quot;Group 031&quot;, &quot;Group 032&quot;, &quot;Group IT&quot;,
&quot;OfficeStaff&quot;)

ADsDLMemPath = &quot;LDAP://Bones/cn=&quot; & MailboxDisplayName &
&quot;,cn=Recipients,ou=Cemetary,o=BoneCollectors&quot;

Response.Write &quot;DL Member Path: &quot; & ADsDLMemPath & &quot;<BR>&quot;
Response.Write &quot;ADsPath is: &quot; & ADSpath & &quot;<BR>&quot;

For i = 0 to DLCount - 1
GroupFormField = &quot;DL_&quot; + CStr (i)
if request(GroupFormField) = &quot;ON&quot; then
if DistListNames(i) <> &quot;&quot; then
'Bind to the Distribution List in the Exchange Directory
Response.Write &quot;DistList: &quot; & GroupFormField & &quot; (&quot; &
DistListNames(i) & &quot;) <BR>&quot;
ADsThisDLPath = &quot;LDAP://Bones/cn=&quot; & DistListNames(i) &
&quot;,cn=Recipients,ou=Cemetary,o=BoneCollectors&quot;
Response.Write &quot;ThisDL path: &quot; & ADsThisDLPath & &quot;<BR>&quot;
Set oDLObj = GetObject (ADsThisDLPath)
if Err.Number <> 0 then
Response.Write &quot;Could not bind to DistList: &quot; &
ADsThisDLPath & &quot;<BR>&quot;
Err.Clear
else
Response.Write &quot;Bound to DistList: &quot; & oDLObj.ADsPath &
&quot;<BR>&quot;
end if
'*************Here is the problem area ??****************
oDLObj.Add Mailbox.ADsPath
'oDLObj.Add Mailbox
'oDLObj.Add (ADsDLMemPath)
'oDLObj.Add ADsDLMemPath
'oDLObj.SetInfo
'******Ive tried all the above methods remmed out*******
if Err.Number <> 0 then
ErrorMessage = &quot;Could not add User to DistList: Error #&quot; &
CStr(Err.Number) & _
&quot;-&quot; & Err.Description & &quot;<BR>&quot;
Response.Write (ErrorMessage)
Err.Clear
else
Response.Write &quot;User added to DistList. <BR>&quot;
end if
end if
end if
Next

===================

Any ideas??
TIA


Ina
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top