Not sure if this is the correct forum, but here goes... I am writing a program in vb6 to setup users on our network. I have this sub that updates the Exchange settings and it works except when setting the Distribution list (memberOf) property. I get an error of "General access denied". We are running Exchange 5.5 on NT 4.0 server, no AD. Any ideas why?
Code:
Private Sub UpdateExchangeSettings(strUserID)
On Error GoTo Err_UpdateExchangeSettings
Const ADS_PROPERTY_CLEAR = 1
Const ADS_PROPERTY_UPDATE = 2
Const ADS_PROPERTY_APPEND = 3
Const ADS_PROPERTY_DELETE = 4
Dim objRecip As Object, objCopyRecip As Object
Dim strMailBoxPath$, sControl$, memberOf As Variant, member As Variant
Dim I As Integer, memberArray()
I = 0
strMailBoxPath = lblLDAPPath.Caption
sControl = "UpdateExchangeSettings(" & strUserID & ")"
Set objRecip = GetObject("LDAP://" & txtMailServer.Text & "/" & strMailBoxPath)
Set objCopyRecip = GetObject("LDAP://" & txtMailServer.Text & "/o=" & txtOrg.Text & "/ou=" & txtOU.Text & "/cn=Recipients/cn=" & lstUsers.Text)
objRecip.put "title", txtTitle.Text
grdDepts.Col = 1
objRecip.put "Department", grdDepts.Text
objRecip.put "company", "myCompany"
objRecip.put "physicalDeliveryOfficeName", "myCity"
objRecip.put "telephoneNumber", txtExt.Text
objRecip.setinfo
memberOf = objCopyRecip.get("memberOf")
If IsArray(memberOf) Then
For Each member In memberOf
'MsgBox member
ReDim Preserve memberArray(I)
memberArray(I) = "/" & member
I = I + 1
Next
objRecip.putex ADS_PROPERTY_UPDATE, "memberOf", memberArray()
Else
'MsgBox memberOf
objRecip.putex ADS_PROPERTY_UPDATE, "memberOf", memberOf
End If
objRecip.setinfo
Exit Sub
Err_UpdateExchangeSettings:
ErrorOut (sControl)
End Sub