Solved

How To Get user Records from Active Directory using c# windows application

Posted on 2010-11-13
3
539 Views
Last Modified: 2012-05-10
Hi,
I need to access the users in the current domain in the active directory.

i use the following code:
 DirectoryEntry oDE;
            oDE = new DirectoryEntry("LDAP://134.156.16.1/CN=USers;DC=Domainname", "Username", "password", AuthenticationTypes.Secure);
         
                           DirectorySearcher dirser = new DirectorySearcher(oDE);
            dirser.Filter = string.Format("(SAMAccountName={0})", "Vijay");
            dirser.PropertiesToLoad.Add("cn");
            SearchResult re = dirser.FindOne();

i get the following error:

"A referral was returned from the server"

0
Comment
Question by:rengsons
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
Rajkumar Gs earned 500 total points
ID: 34127091
Check the code under the comment /// Loads the ad users. in this link
http://www.volumeracing.com/blog/?p=129

Code for most of the other operations are also demonstated here.

Regards
Raj
0
 
LVL 12

Expert Comment

by:jagssidurala
ID: 34128259
Refer this link

http://www.codeproject.com/KB/system/everythingInAD.aspx


For the error which you have getting refer these links

http://directoryprogramming.net/forums/thread/2743.aspx
0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 34881444
rengsons, any update ?

Raj
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Angular - break the dataset in chunks? 7 50
System.Security 2 27
send messages to whatsapp programatically 2 48
2 questions 10 25
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

773 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