Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2010-11-13
3
Medium Priority
?
552 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
Rajkumar Gs earned 2000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

722 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