DirectoryEntries.Find 메서드

정의

이 컬렉션의 멤버를 반환합니다.

오버로드

Name Description
Find(String)

지정된 이름의 이 컬렉션의 멤버를 반환합니다.

Find(String, String)

지정된 이름과 지정된 형식의 이 컬렉션의 멤버를 반환합니다.

Find(String)

Source:
DirectoryEntries.cs
Source:
DirectoryEntries.cs
Source:
DirectoryEntries.cs
Source:
DirectoryEntries.cs
Source:
DirectoryEntries.cs
Source:
DirectoryEntries.cs
Source:
DirectoryEntries.cs
Source:
DirectoryEntries.cs

지정된 이름의 이 컬렉션의 멤버를 반환합니다.

public:
 System::DirectoryServices::DirectoryEntry ^ Find(System::String ^ name);
public System.DirectoryServices.DirectoryEntry Find(string name);
member this.Find : string -> System.DirectoryServices.DirectoryEntry
Public Function Find (name As String) As DirectoryEntry

매개 변수

name
String

검색할 자식 개체의 이름을 포함합니다.

반품

DirectoryEntry 찾은 자식 개체를 나타내는 A입니다.

예외

Active Directory Domain Services 개체는 컨테이너가 아닙니다.

기본 인터페이스를 호출하는 동안 오류가 발생했습니다.

설명

형식이 다른 자식 개체의 이름이 같으면 일치하는 첫 번째 자식 개체가 반환됩니다.

메모

인터넷 정보 서비스(IIS) 공급자는 이 메서드를 지원하지 않습니다. 오버로드된 Find 메서드를 사용하고 매개 변수에 빈 문자열("")을 지정합니다 schemaClassName .

일치하는 결과가 DirectoryServicesCOMException 없으면 오류 코드 0x2030 throw됩니다.

적용 대상

Find(String, String)

Source:
DirectoryEntries.cs
Source:
DirectoryEntries.cs
Source:
DirectoryEntries.cs
Source:
DirectoryEntries.cs
Source:
DirectoryEntries.cs
Source:
DirectoryEntries.cs
Source:
DirectoryEntries.cs
Source:
DirectoryEntries.cs

지정된 이름과 지정된 형식의 이 컬렉션의 멤버를 반환합니다.

public:
 System::DirectoryServices::DirectoryEntry ^ Find(System::String ^ name, System::String ^ schemaClassName);
public System.DirectoryServices.DirectoryEntry Find(string name, string? schemaClassName);
public System.DirectoryServices.DirectoryEntry Find(string name, string schemaClassName);
member this.Find : string * string -> System.DirectoryServices.DirectoryEntry
Public Function Find (name As String, schemaClassName As String) As DirectoryEntry

매개 변수

name
String

검색할 자식 디렉터리 개체의 이름입니다.

schemaClassName
String

검색할 자식 디렉터리 개체의 클래스 이름입니다.

반품

DirectoryEntry 찾은 자식 개체를 나타내는 개체입니다.

예외

Active Directory Domain Services 개체는 컨테이너가 아닙니다.

기본 인터페이스를 호출하는 동안 오류가 발생했습니다.

예제

다음 예제에서는 지정된 경로를 사용하여 새 DirectoryEntry 개체를 만든 다음 컨테이너에 새 항목을 만들고 저장합니다. 새로 만든 항목을 검색하려고 시도합니다.

Try
     Dim myEntry1 As DirectoryEntry
     Dim myEntry2 As DirectoryEntry
     Dim strPath As String = "LDAP://DC=fabrikam,DC=com"

     ' Create a 'DirectoryEntry' object with the given path.
     Dim myDE As New DirectoryEntry(strPath)
     Dim myEntries As DirectoryEntries = myDE.Children

     ' Create a new entry in the container.
     myEntry1 = myEntries.Add("CN=Sample Entry", myDE.SchemaClassName)
     ' Save changes in the 'Active Directory Domain Services' store.
     myEntry1.CommitChanges()

     ' Find a child in the 'DirectoryEntries' collection which has the
     ' specified name and type.
     myEntry2 = myEntries.Find("CN=Sample Entry", myDE.SchemaClassName)
     Console.WriteLine(myEntry2.Name + " is found in container.")

     Catch e As Exception
          Console.WriteLine("The following exception was raised : {0}", e.Message.ToString())
     End Try
using System;
using System.DirectoryServices;

class MyClass1
{
   static void Main()
   {
      try
      {
         DirectoryEntry myEntry1;
         DirectoryEntry myEntry2;
         String strPath = "LDAP://DC=fabrikam,DC=com";

         // Create a 'DirectoryEntry' object with the given path.
         DirectoryEntry myDE = new DirectoryEntry(strPath);
         DirectoryEntries myEntries = myDE.Children;

         // Create a new entry in the container.
         myEntry1 = myEntries.Add("CN=Sample Entry",myDE.SchemaClassName);
         // Save changes in the 'Active Directory Domain Services' store.
         myEntry1.CommitChanges();

         // Find a child in the 'DirectoryEntries' collection which has the
         // specified name and type.
         myEntry2 = myEntries.Find("CN=Sample Entry",myDE.SchemaClassName);
         Console.WriteLine (myEntry2.Name + " is found in container.");

      }
      catch(Exception e)
      {
         Console.WriteLine("The following exception was raised : {0}",e.Message);
      }
   }
}

설명

일치하는 결과가 DirectoryServicesCOMException 없으면 오류 코드 0x2030 throw됩니다.

적용 대상