Solved

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

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Suggested Courses

734 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