태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.
페이지를 읽고 있습니다. ( 아쿠아바다's Blog )
분류 전체보기 (769)
쉐어포인트 (24)
Exchange (12)
SQL (121)
XML (36)
WEB (294)
O / S (97)
삶의향기 (162)
기획 (19)
RSS 피드(IE 7.0부터 기본 지원됩니다. 이전 버전 사용자는 접합한 툴을 사용하세요!!)

ADSI 속성 호출

WEB/ASP / DotNet 2007/06/07 17:29 by 아쿠아바다

MSDN Library > Visual Studio 2005 > Visual Studio 설명서 > Visual Studio에서 .NET Framework 프로그래밍 > .NET Framework 고급 개발 > 운영 및 관리 > 디렉터리 서비스 > System.DirectoryServices 네임스페이스 개요 > System.DirectoryServices 사용 > System.DirectoryServices에서 시작 > 고급 프로그래밍 항목 > ADSI 호출 > ADSI 속성 호출
언어 필터 : 모든 항목 선택Visual Basic

C#

C++

J#

JScript


ADSI 속성 호출 

ADSI COM 개체의 속성은 두 가지 방식 중 하나로 직접 액세스할 수 있습니다. 첫 번째 방식은 InvokeMember 메서드를 사용하는 것입니다. 두 번째 방식은 Microsoft .NET Framework version 2.0의 새로운 InvokeGet 및 InvokeSet 메서드를 사용하는 것입니다.

다음 C# 예에서는 InvokeMember 메서드를 사용하여 관리 코드 응용 프로그램에서 IADSUser 속성, FirstName 속성 및 LastName 속성을 검색하는 방법을 보여 줍니다. 이러한 속성에 대한 자세한 내용은 MSDN Library(http://msdn.microsoft.com/library)의 "IADsUser", "FirstName" 및 "LastName" 항목을 참조하십시오.

C# 코드 복사using System.Reflection;
using System.DirectoryServices;

DirectoryEntry ent = new DirectoryEntry("LDAP://CN=My User,DC=Fabrikam,DC=com");
Object ads = ent.NativeObject;
Type type = ads.GetType();
String firstName = (string)type.InvokeMember(
    "FirstName",
    BindingFlags.GetProperty,
    null,
    ads,
    null);
String lastName = (string)type.InvokeMember(
    "LastName",
    BindingFlags.GetProperty,
    null,
    ads,
    null);


다음 Visual Basic 예에서는 InvokeMember 메서드를 사용하여 관리 코드 응용 프로그램에서 IADSUser 속성, FirstName 속성 및 LastName 속성을 검색하는 방법을 보여 줍니다. 이러한 속성에 대한 자세한 내용은 MSDN Library(http://msdn.microsoft.com/library)의 "IADsUser", "FirstName" 및 "LastName" 항목을 참조하십시오.

Visual Basic 코드 복사Imports System.Reflection
Imports System.DirectoryServices

Dim ent As New DirectoryEntry("LDAP://CN=My User,DC=Fabrikam,DC=com")
Dim ads As [Object] = ent.NativeObject
Dim type As Type = ads.GetType()
Dim firstName As String = CStr(type.InvokeMember( _
    "FirstName", _
    BindingFlags.GetProperty, _
    Nothing, _
    ads, _
    Nothing))
Dim lastName As String = CStr(type.InvokeMember( _
    "LastName", _
    BindingFlags.GetProperty, _
    Nothing, _
    ads, _
    Nothing))


다음 C# 예에서는 InvokeGet 메서드를 사용하여 관리 코드 응용 프로그램에서 IADSUser 속성, FirstName 속성 및 LastName 속성을 검색하는 방법을 보여 줍니다. 이러한 속성에 대한 자세한 내용은 MSDN Library(http://msdn.microsoft.com/library)의 "IADsUser", "FirstName" 및 "LastName" 항목을 참조하십시오.

.

[C#]

using System.DirectoryServices;

DirectoryEntry ent = new DirectoryEntry("LDAP://CN=My User,DC=Fabrikam,DC=com");
String firstName = (string)ent.InvokeGet("FirstName");
String lastName = (string)ent.InvokeGet("LastName");

다음 Visual Basic 예에서는 InvokeGet 메서드를 사용하여 관리 코드 응용 프로그램에서 IADSUser 속성, FirstName 속성 및 LastName 속성을 검색하는 방법을 보여 줍니다. 이러한 속성에 대한 자세한 내용은 MSDN Library(http://msdn.microsoft.com/library)의 "IADsUser", "FirstName" 및 "LastName" 항목을 참조하십시오.

Visual Basic 코드 복사Imports System.DirectoryServices

Dim ent As New DirectoryEntry("LDAP://CN=My User,DC=Fabrikam,DC=com")
Dim firstName As String = CStr(ent.InvokeGet("FirstName"))
Dim lastName As String = CStr(ent.InvokeGet("LastName"))


다음 C# 예에서는 InvokeMember 메서드를 사용하여 개체의 Description 속성을 설정하는 방법을 보여 줍니다.

C# 코드 복사using System.Reflection;
using System.DirectoryServices;

DirectoryEntry ent = new DirectoryEntry("LDAP://CN=My User,DC=Fabrikam,DC=com");
Object ads = ent.NativeObject;
Type type = ads.GetType();
type.InvokeMember("Description",
    BindingFlags.SetProperty,
    null,
    ads,
    new object[] {"some description"});

// The changes to the object must always be committed or else they
// will be lost.
ent.CommitChanges();


다음 Visual Basic 예에서는 InvokeMember 메서드를 사용하여 개체의 Description 속성을 설정하는 방법을 보여 줍니다.

Visual Basic 코드 복사Imports System.Reflection
Imports System.DirectoryServices

Dim ent As New DirectoryEntry("LDAP://CN=My User,DC=Fabrikam,DC=com")
Dim ads As [Object] = ent.NativeObject
Dim type As Type = ads.GetType()
type.InvokeMember("Description", _
    BindingFlags.SetProperty, _
    Nothing, _
    ads, _
    New Object() {"some description"})

' The changes to the object must always be committed or else they
' will be lost.
ent.CommitChanges()


다음 C# 예에서는 InvokeSet 메서드를 사용하여 디렉터리 항목의 Description 속성을 설정하는 방법을 보여 줍니다. Description 속성에 대한 자세한 내용은 MSDN Library(http://msdn.microsoft.com/library)의 "Description" 항목을 참조하십시오.

C# 코드 복사using System.DirectoryServices;

DirectoryEntry ent = new DirectoryEntry("LDAP://CN=My User,DC=Fabrikam,DC=com");
ent.InvokeSet("Description", new object[] {"some description"});

// The changes to the object must always be committed or else they
// will be lost.
ent.CommitChanges();


다음 Visual Basic 예에서는 InvokeSet 메서드를 사용하여 디렉터리 항목의 Description 속성을 설정하는 방법을 보여 줍니다. Description 속성에 대한 자세한 내용은 MSDN Library(http://msdn.microsoft.com/library)의 "Description" 항목을 참조하십시오.

Visual Basic 코드 복사Imports System.DirectoryServices

Dim ent As New DirectoryEntry("LDAP://CN=My User,DC=Fabrikam,DC=com")
ent.InvokeSet("Description", New Object() {"some description"})

' The changes to the object must always be committed or else they
' will be lost.
ent.CommitChanges()


'WEB > ASP / DotNet' 카테고리의 다른 글

Use Forms Authentication with Active Directory in ASP.NET 1.1  (0) 2007/06/07
ADSI 메서드 호출  (0) 2007/06/07
ADSI 속성 호출  (0) 2007/06/07
Asp.net 2.0 login  (0) 2007/06/07
닷넷 공부에 꽤 큰 도움이 되는 사이트  (0) 2007/06/07
AJAX.NET  (0) 2007/06/07
좀더 흥미로운 내용이 많이 있습니다.. HOME > WEB/ASP / DotNet를 확인하세요
TAG   
0 Trackback, 0 Comment, :
1  ... 319 320 321 322 323 324 325 326 327  ... 769 
Statistics Graph
Total : 557,403 Today : 33