전자 메일 주소와 함께 전체 사용자 목록을 얻으려고합니다.DirectoryServices 검색 범위 초과 오류
이A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
아무도 이런 일이 어떻게이 문제를 방지하는 이유를 알고 있습니까 : 많은 것들을 시도 후에 아래 마침내 그러나 나는이 오류이 오류가 나에게 기쁨의 어떤 형태를 준있다? 전체 코드는 다음과 같습니다. 이 res.Properties를 가정 한 것입니다처럼 보이는
Dim entry As DirectoryEntry = Nothing
Dim search As DirectorySearcher = Nothing
entry = New DirectoryEntry()
search = New DirectorySearcher()
search.Filter = "(&(objectCategory=person)(objectClass=user)(mail=*@companyname.com*))"
search.Sort.PropertyName = "cn"
Dim result As SearchResultCollection = search.FindAll()
For Each res As SearchResult In result
Dim Name = res.Properties("cn")(0).ToString()
Dim Email = res.Properties("mail")(0).ToString()
WindowsForm1.ListBox1.Items.Add(Name & " <" & Email & ">")
Next
entry.Dispose()
search.Dispose()
result.Dispose()