Click here to Skip to main content
15,893,487 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow to get list of users from AD Group? Pin
VinothRao18-Aug-11 3:47
VinothRao18-Aug-11 3:47 
Hi All,

I need desperate help.

I have a group "MyGroupABC" in Active Directory (AD). In this group there are close to 100 list of users.

How can i write a logic to actually to get me the list of users with their particulars details such as Name, SN, GivenName, Telephone, Mail, etc?

I've been trying many days to figuring it out, but not success.

Below is my simple code.

C#
DirectorySearcher ds = new DirectorySearcher("");
ds.SearchRoot = new DirectoryEntry("LDAP://myserver/CN=MyGroupABC,OU=MyProject,OU=DEVApplications,DC=myserver,DC=local");
ds.PropertyNamesOnly = true;
ds.PropertiesToLoad.Add("name");
ds.PropertiesToLoad.Add("sn");
ds.PropertiesToLoad.Add("givenName");
ds.PropertiesToLoad.Add("mail");
ds.PropertiesToLoad.Add("telephoneNumber");

SearchResultCollection src = ds.FindAll();

try 
{
   foreach (SearchResult sr in src)
   {
      string str1 = de.name.ToString();
      string str2 = de.sn.ToString();
      string str3 = de.givenName.ToString();
      string str4 = de.mail.ToString();
      string str5 = de.telephoneNumber.ToString();
   }
}
catch (Exception e)
{
   MessageBox.Show(e.Message);
}


the ds.FindAll() result get returns empty.

Is there any better way to do around this?
AnswerRe: How to get list of users from AD Group? Pin
GenJerDan18-Aug-11 4:58
GenJerDan18-Aug-11 4:58 
QuestionDisable DropDownList at ClientSide Pin
Naunt17-Aug-11 20:30
Naunt17-Aug-11 20:30 
AnswerRe: Disable DropDownList at ClientSide Pin
Anurag Gandhi17-Aug-11 21:06
professionalAnurag Gandhi17-Aug-11 21:06 
GeneralRe: Disable DropDownList at ClientSide Pin
Naunt17-Aug-11 21:37
Naunt17-Aug-11 21:37 
AnswerRe: Disable DropDownList at ClientSide Pin
Arun Jacob18-Aug-11 2:30
Arun Jacob18-Aug-11 2:30 
GeneralRe: Disable DropDownList at ClientSide Pin
Naunt18-Aug-11 15:36
Naunt18-Aug-11 15:36 
AnswerRe: Disable DropDownList at ClientSide Pin
Arun Jacob18-Aug-11 19:57
Arun Jacob18-Aug-11 19:57 
GeneralRe: Disable DropDownList at ClientSide Pin
Naunt18-Aug-11 22:37
Naunt18-Aug-11 22:37 
AnswerRe: Disable DropDownList at ClientSide Pin
Arun Jacob19-Aug-11 1:50
Arun Jacob19-Aug-11 1:50 
AnswerRe: Disable DropDownList at ClientSide Pin
Raman Ghantiyala30-Aug-11 20:12
Raman Ghantiyala30-Aug-11 20:12 
Questionpreview before upload image Pin
apadana_198917-Aug-11 15:12
apadana_198917-Aug-11 15:12 
GeneralRe: preview before upload image PinPopular
Michael.Jiangdahua17-Aug-11 15:40
Michael.Jiangdahua17-Aug-11 15:40 
GeneralRe: preview before upload image Pin
Shameel18-Aug-11 22:32
professionalShameel18-Aug-11 22:32 
QuestionBest and Modern Way to Show Data from 6 Different Schemas in the Same Grid or Control Pin
GChuck17-Aug-11 6:43
GChuck17-Aug-11 6:43 
AnswerRe: Best and Modern Way to Show Data from 6 Different Schemas in the Same Grid or Control Pin
Not Active17-Aug-11 7:45
mentorNot Active17-Aug-11 7:45 
GeneralRe: Best and Modern Way to Show Data from 6 Different Schemas in the Same Grid or Control Pin
GChuck17-Aug-11 10:27
GChuck17-Aug-11 10:27 
GeneralRe: Best and Modern Way to Show Data from 6 Different Schemas in the Same Grid or Control Pin
Not Active17-Aug-11 11:09
mentorNot Active17-Aug-11 11:09 
GeneralRe: Best and Modern Way to Show Data from 6 Different Schemas in the Same Grid or Control Pin
GChuck17-Aug-11 16:11
GChuck17-Aug-11 16:11 
QuestionApp_GlobalResources.resources.dll Pin
Satish_S17-Aug-11 0:06
Satish_S17-Aug-11 0:06 
AnswerRe: App_GlobalResources.resources.dll Pin
Shameel17-Aug-11 2:18
professionalShameel17-Aug-11 2:18 
GeneralRe: App_GlobalResources.resources.dll Pin
Satish_S17-Aug-11 2:30
Satish_S17-Aug-11 2:30 
QuestionHow to convert total data in a page into crystal report without dtabase Pin
vangapally Naveen Kumar16-Aug-11 20:25
professionalvangapally Naveen Kumar16-Aug-11 20:25 
QuestionHow to get value from dropdownlist which is in User Control Pin
sujitdeshpande16-Aug-11 19:25
sujitdeshpande16-Aug-11 19:25 
AnswerRe: How to get value from dropdownlist which is in User Control Pin
Anurag Gandhi16-Aug-11 21:33
professionalAnurag Gandhi16-Aug-11 21:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.