サンプルアプリのライブラリ側に組織単位(OU)用のクラスを追加しました。
 組織単位(OU)を表す OrganizationalUnit クラスは DomainObject クラスを継承します。
 そして Webアプリでデータソースとして使えるようにします。
  
  
<DataObject()>  
Public NotInheritable Class OrganizationalUnit  
  Inherits DomainObject  
  
#Region " プライベートフィールド "  
  Private _storedObjects As List(Of DomainObject)  
#End Region  
 
 #Region " フレンドコンストラクタ "  
  'DirectoryEntry を指定して OrganizationalUnit クラスの新しいインスタンスを初期化します。  
  Friend Sub New(entry As DirectoryEntry)  
    MyBase.New(entry)  
  End Sub  
#End Region
  
 #Region " パブリックプロパティ "  
  '市区町村を取得または設定します。  
  Public Property City As String  
    Get  
      If MyBase.IsDisposed Then  
        Throw New ObjectDisposedException(Me.GetType().Name)  
      End If
       Return DirectCast(MyBase.Entry.Properties.Item("l").Value, String)  
    End Get  
    Set(value As String)  
      If MyBase.IsDisposed Then  
        Throw New ObjectDisposedException(Me.GetType().Name)  
      End If  
      MyBase.Entry.Properties.Item("l").Value = value  
    End Set  
  End Property
  
   '郵便番号を取得または設定します。  
  Public Property PostalCode As String  
    Get  
      If MyBase.IsDisposed Then  
        Throw New ObjectDisposedException(Me.GetType().Name)  
      End If
       Return DirectCast(MyBase.Entry.Properties.Item("postalCode").Value, String)  
    End Get  
    Set(value As String)  
      If MyBase.IsDisposed Then  
        Throw New ObjectDisposedException(Me.GetType().Name)  
      End If
       MyBase.Entry.Properties.Item("postalCode").Value = value  
    End Set
   End Property
  
   '都道府県を取得または設定します。  
  Public Property Prefecture As String  
    Get  
      If MyBase.IsDisposed Then  
        Throw New ObjectDisposedException(Me.GetType().Name)  
      End If
       Return DirectCast(MyBase.Entry.Properties.Item("st").Value, String)  
    End Get  
    Set(value As String)  
      If MyBase.IsDisposed Then  
        Throw New ObjectDisposedException(Me.GetType().Name)  
      End If
       MyBase.Entry.Properties.Item("st").Value = value  
    End Set
   End Property
  
   '直下のオブジェクトを取得します。  
  Public ReadOnly Property StoredDomainObjects As IList(Of DomainObject)  
    Get  
      If MyBase.IsDisposed Then  
        Throw New ObjectDisposedException(Me.GetType().Name)  
      End If
       If _storedObjects Is Nothing Then  
        _storedObjects = DirectoryAccess.GetStoredDomainObjects(Me)   '直下のオブジェクトを取得  
      End If
       Return _storedObjects  
    End Get  
  End Property
  
   '番地を取得または設定します。  
  Public Property Street As String  
    Get  
      If MyBase.IsDisposed Then  
        Throw New ObjectDisposedException(Me.GetType().Name)  
      End If
       Return DirectCast(MyBase.Entry.Properties.Item("street").Value, String)  
    End Get  
    Set(value As String)  
      If MyBase.IsDisposed Then  
        Throw New ObjectDisposedException(Me.GetType().Name)  
      End If
       MyBase.Entry.Properties.Item("street").Value = value  
    End Set
   End Property
 #End Region
  
 #Region " パブリックメソッド "  
  '指定したパスの組織単位(OU)を検索します。このメソッドはデータバインド用です。
   <DataObjectMethod(DataObjectMethodType.Select)>  
  Public Shared Function FindByPath(path As String) As OrganizationalUnit  
    'distinguishedNameを生成  
    Dim ouNames = path.Split("/"c).Reverse()  
    Dim sb As New StringBuilder()  
    For Each ouName In ouNames  
      sb.AppendFormat("OU={0},", ouName)  
    Next  
    For Each dc In DirectoryAccess.DomainName.Split("."c)  
      sb.AppendFormat("DC={0},", dc)  
    Next
     sb.Length -= 1  
    Return DirectCast(DirectoryAccess.FindDirectoryObject(sb.ToString(), CategoryType.OrganizationalUnit), OrganizationalUnit)  
  End Function  
#End Region
  
 #Region " プロテクトメソッド "  
  '使用されているリソースを解放します。
   Protected Overrides Sub Dispose(disposing As Boolean)
     If _storedObjects IsNot Nothing Then  
      DirectoryAccess.DisposeItems(_storedObjects)   'リソースを解放  
      _storedObjects = Nothing
     End If
     MyBase.Dispose(disposing)
   End Sub
 #End Region
 End Class
  
 プロパティ・メソッドの説明と 内部で呼び出している DirectoryAccess クラスのメソッドについては別途書きます。