我有一个函数可以让我在这里编辑用户的 manager 属性:
Public Shared Sub SetManagerProperty(ByVal de As DirectoryEntry, ByVal pName As String, ByVal pValue As String)
'First make sure the property value isnt "nothing"
If Not pValue Is Nothing Then
'Check to see if the DirectoryEntry contains this property already
If de.Properties.Contains(pName) Then 'The DE contains this property
'Update the properties value
de.Properties(pName)(0) = pValue
Else 'Property doesnt exist
'Add the property and set it's value
'de.Properties(pName).Add("cn=" & frmOrganization.txtManagerName.Text & ",OU=Company,OU=Users,OU=Summit,OU=North America,DC=mycompany,DC=com")
End If
End If
End Sub
但是,如果经理不在公司 OU 中怎么办?我如何编辑它以在整个域中搜索他?