AspNet.sk     Diskusné fóra     Vitajte v QuickStarts     ASP.NET     Silverlight     Ako môžem...? (en)     Class prehliadač Príklady chcem v ...   
Menu
Skip Navigation Links.

How Do I...? Common Tasks QuickStart Tutorial

How Do I...Modify Active Directory?


The Active Directory Service Interface (ADSI) accesses the capabilities of directory services from different network providers in a distributed computing environment to present a single set of directory service interfaces for managing network resources. Administrators and developers can use ADSI services to enumerate and manage the resources in a directory service, regardless of which network environment contains the resource. Use Active Directory to perform common administrative tasks, such as adding new users and managing printers throughout the distributed computing environment.

This sample illustrates how to change a value of a property of an Active Directory entry. It is a small console application that can be run from a command prompt. The application takes three command line arguments. The first argument must be a valid path to an active directory entry. The second argument is a property name of the entry. The third argument is the new value of the entry.
Try running the following command substituting the path and property name for a valid Active Directory path for your particular network:
> ADWrite.exe "LDAP://DC=Microsoft,DC=COM" "name" "Microsoft"

In its simplest form, writing to the Active Directory involves:
  1. Creating a new DirectoryEntry:

    
    Dim adPath As String = ...
    Dim objDirEnt As DirectoryEntry = New DirectoryEntry(adPath)
    
    VB

  2. Setting the DirectoryEntry object's properties:

    
    Dim propertyName As String = ...
    Dim newValue As String = ...
    
    objDirEnt.Properties(propertyName).Value = newValue
    
    VB

  3. Committing the changes to the Active Directory:

    
    objDirEnt.CommitChanges()
    
    VB

Example

VB ADWrite.exe
View Source

[This sample can be found at H:\Home\WU_000036_efe47225c86ca62f325a01d8519bc002\Webs\aspnet.sk\quickstarts\QuickStartv20\howto\samples\Services\DirectoryServices\ADWrite\
To build this sample, open the SDK command prompt and navigate to the above path. Build the sample using the build tool msbuild passing the solution file as the first parameter: msbuild mySample.sln. The compiled executable will be found in the sub directory \bin directory.]




Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright � 2005 Microsoft Corporation. All rights reserved.


Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright © 2005 Microsoft Corporation. All rights reserved.
Preklad do slovenského jazyka - Copyright © 2005 - 2007 www.aspnet.sk, www.qsh.sk
Pošlite komentár k tejto stránke
Copyright © 2002 - 2008 Chastia, spol. s r. o., Igor Stanek, Designed by Lacino
Portál je hostovaný na serveroch firmy Quantasoft - www.qsh.sk.