Active Directory .NET System.DirectoryServices - Dump Schema Information

original article

http://www.codeproject.com/aspnet/adsi1.asp?msg=757258

 

Try

'---------------------------------------------------------------

'build me.ActiveDirectoryPropertyList

'the list should contain key-value pairs that match with the properties

'(e.g. DisplayName) of this class

' Key: displayname, Value: Vinyard, Rodney (Consultant)

'---------------------------------------------------------------

Dim result As SearchResult

Dim strKey As String

For Each strKey In resultPropertyCollection.PropertyNames

Dim obProp As Object

For Each obProp In resultPropertyCollection(strKey)

Dim duhString As String = "Key: " + strKey + ", Value: "

Dim duhValue As String = "?"

Try

duhValue = CStr(obProp)

Catch ex2 As Exception

'do nothing

End Try

duhString += duhValue

System.Diagnostics.Debug.WriteLine(duhString)

_sb.Append(Microsoft.VisualBasic.vbCrLf + duhString)

Next

Next

Catch ex As Exception

_sb.Append(Microsoft.VisualBasic.vbCrLf + ex.ToString)

End Try

End Sub

Private _sb As New System.Text.StringBuilder

Public ReadOnly Property ActiveDirectoryPropertyList() As String

Get

Return _sb.ToString

End Get

End Property