ADSI with c# ( questions and help

Posted on 2004-11-24
Last Modified: 2008-03-04
Hi there,

I wonder if anybody can help?

I have been trying to looki at implementing ADSI with c# ( but it has been very hard to find any documentation to the available object, methods, properties etc.

Tried search for a book but nothing withc#,

Does anybody know where i can find some documention or help with ADSI ... specifically with c#

Also, i noticed ADSI uses COM (am I right?), so is ADSI an old technology that is going to be replaced (or already replaced) with a new technology??

Is ADSI installed autoamtically with Windows 2003 Server (IIS) and

My main aim with adsi is to be able to create Websites, ftp accounts, Email accounts (which i have only found MS Exchange to support, maybe I am wrong??)

Any help or information with regards to any of the above woudl be really appreciated

Thanks in advance

Question by:ianinspain
    LVL 16

    Accepted Solution

    You use ADSI via the System.DirectoryServices namespace. There is an overview at:
    LVL 1

    Assisted Solution

      Try following links also. Hope it helps you.


    Author Comment

    Thanks everyone, actually I managed to pickup an ADSI help file, which is very VB /VBSCRIPT types

    Anyone know an easy way to use this and convert to .NET classes.... is there an easy way??

    I wish somebody would produce a c# / ADSI book..

    ADSI books seem very thin on the ground..

    LVL 16

    Assisted Solution

    That is exactly what the System.DirectoryServices namespace is all about. Here is an example that adds a user to a group:

    DirectoryEntry dom = new DirectoryEntry();
    DirectoryEntry group = dom.Children.Find("CN=Consulting");

    // Add a single user to a group;
    DirectoryEntry usr = group.Children.Find("CN=New User");

    // To add multiple users to a group use
    //group.Properties["member"].AddRange(new string[] {"userDN1","userDN2"});

    //To add the user's distinguished name to the member property
    //on the group object, use the Add method.

    //Commit the changes to the directory.

    As an alternative, search MSDN for "Using COM Interop to Access ADSI".

    Author Comment

    cheers guys! points split,.

    Best regards


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now