Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-11-13
3
Medium Priority
?
553 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

916 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