When using the following ASP.Net code the error "The directory service
cannot perform the requested operation on the RDN attribute of an object."
is displayed when the commit changes is run. What modifications need to be
made to the code to allow it to update the details?
Dim rootDSE As New DirectoryEntry( "LDAP://RootDSE")
Dim namingContext As String =
rootDSE.Propert ies("defaultNam ingContext").Va lue.ToString()
Dim searchRoot As New DirectoryEntry( "LDAP://" & namingContext)
Dim searcher As New DirectorySearch er
searcher.Search Root = searchRoot
searcher.Filter =
String.Format(" (&(objectCatego ry=person)(obje ctClass=user)(s amAccountName={ 0
}))", cUser)
searcher.Proper tiesToLoad.AddR ange(New String() { _
"name", "givenName" , "sn", "initials", "personalTitle" ,
"extensionAttri bute1", _
"department ", "title", "descriptio n", "info", "roomNumber ",
_
"telephoneNumbe r", "mail", "homePostalAddr ess",
"extensionAttri bute2" _
})
Dim result As SearchResult = searcher.FindOn e()
Dim onUser As System.Director yServices.Direc toryEntry =
result.GetDirec toryEntry
onUser.Properti es("name").Valu e = NZ(tbPreferredN ame.Text) ' a text
field
' save details back to AD
onUser.CommitCh anges()
cannot perform the requested operation on the RDN attribute of an object."
is displayed when the commit changes is run. What modifications need to be
made to the code to allow it to update the details?
Dim rootDSE As New DirectoryEntry( "LDAP://RootDSE")
Dim namingContext As String =
rootDSE.Propert ies("defaultNam ingContext").Va lue.ToString()
Dim searchRoot As New DirectoryEntry( "LDAP://" & namingContext)
Dim searcher As New DirectorySearch er
searcher.Search Root = searchRoot
searcher.Filter =
String.Format(" (&(objectCatego ry=person)(obje ctClass=user)(s amAccountName={ 0
}))", cUser)
searcher.Proper tiesToLoad.AddR ange(New String() { _
"name", "givenName" , "sn", "initials", "personalTitle" ,
"extensionAttri bute1", _
"department ", "title", "descriptio n", "info", "roomNumber ",
_
"telephoneNumbe r", "mail", "homePostalAddr ess",
"extensionAttri bute2" _
})
Dim result As SearchResult = searcher.FindOn e()
Dim onUser As System.Director yServices.Direc toryEntry =
result.GetDirec toryEntry
onUser.Properti es("name").Valu e = NZ(tbPreferredN ame.Text) ' a text
field
' save details back to AD
onUser.CommitCh anges()
Comment