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

Exchange 5.5 LDAP - Access Denied editing Dist List

Status
Not open for further replies.

cruford

Programmer
Joined
Dec 6, 2002
Messages
138
Location
US
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
 
>[tt]memberOf = objCopyRecip.get("memberOf")[/tt]
Do this?
[tt]memberOf = objCopyRecip.get[red]ex[/red]("memberOf")[/tt]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top