Solved

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

Posted on 2010-11-13
3
535 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

20 Experts available now in Live!

Get 1:1 Help Now