DirectoryEntries.Add(String, String) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컨테이너에 새 항목을 만듭니다.
public:
System::DirectoryServices::DirectoryEntry ^ Add(System::String ^ name, System::String ^ schemaClassName);
public System.DirectoryServices.DirectoryEntry Add(string name, string schemaClassName);
member this.Add : string * string -> System.DirectoryServices.DirectoryEntry
Public Function Add (name As String, schemaClassName As String) As DirectoryEntry
매개 변수
- name
- String
새 항목의 이름입니다.
- schemaClassName
- String
새 항목에 사용되는 스키마의 이름입니다.
반품
DirectoryEntry 새 항목을 나타내는 개체입니다.
예외
기본 인터페이스를 호출하는 동안 오류가 발생했습니다.
예제
다음 예제에서는 지정된 경로가 있는 새 DirectoryEntry 개체를 만든 다음 컨테이너에 새 항목을 만들고 저장합니다.
Dim strPath As String = "IIS://localhost/W3SVC/1/Root"
' Create a new 'DirectoryEntry' object with the given path.
Dim myDE As New DirectoryEntry(strPath)
Dim myEntries As DirectoryEntries = myDE.Children
' Create a new entry 'Sample' in the container.
Dim myDirectoryEntry As DirectoryEntry = myEntries.Add("CN=Sample", myDE.SchemaClassName)
' Save changes of entry in the 'Active Directory Domain Services'.
myDirectoryEntry.CommitChanges()
Console.WriteLine(myDirectoryEntry.Name + " entry is created in container.")
String strPath = "IIS://localhost/W3SVC/1/Root";
// Create a new 'DirectoryEntry' object with the given path.
DirectoryEntry myDE = new DirectoryEntry(strPath);
DirectoryEntries myEntries = myDE.Children;
// Create a new entry 'Sample' in the container.
DirectoryEntry myDirectoryEntry =
myEntries.Add("CN=Sample", myDE.SchemaClassName);
// Save changes of entry in the 'Active Directory Domain Services'.
myDirectoryEntry.CommitChanges();
Console.WriteLine (myDirectoryEntry.Name + " entry is created in container.");
설명
생성을 CommitChanges 영구적으로 만들려면 새 항목에서 메서드를 호출해야 합니다. 이 메서드를 호출할 때 새 항목에 필수 속성 값을 설정할 수 있습니다. 공급자는 각각 메서드를 호출하기 전에 설정해야 하는 속성에 CommitChanges 대한 요구 사항이 다릅니다. 이러한 요구 사항이 충족되지 않으면 공급자가 예외를 throw할 수 있습니다. 변경 내용을 커밋하기 전에 설정해야 하는 속성을 확인하려면 공급자에게 문의하세요.