Click here to Skip to main content
15,889,315 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Create new web browser Pin
Pete O'Hanlon16-Oct-08 9:37
mvePete O'Hanlon16-Oct-08 9:37 
GeneralRe: Create new web browser Pin
Paul Conrad16-Oct-08 11:04
professionalPaul Conrad16-Oct-08 11:04 
AnswerRe: Create new web browser Pin
Dave Kreskowiak16-Oct-08 10:38
mveDave Kreskowiak16-Oct-08 10:38 
JokeRe: Create new web browser Pin
Paul Conrad16-Oct-08 11:05
professionalPaul Conrad16-Oct-08 11:05 
AnswerRe: Create new web browser Pin
Paul Conrad16-Oct-08 11:03
professionalPaul Conrad16-Oct-08 11:03 
JokeRe: Create new web browser Pin
Mark Salsbery16-Oct-08 11:06
Mark Salsbery16-Oct-08 11:06 
AnswerRe: Create new web browser Pin
Shyam Bharath20-Oct-08 0:25
Shyam Bharath20-Oct-08 0:25 
QuestionFetching member data from the DL within the OU Pin
Vipul Mehta16-Oct-08 6:31
Vipul Mehta16-Oct-08 6:31 
Hi,



I have a requirement where in we need to fetch the member details within a DL. The DL resides within a Organizational Unit (OU). The DL name is DistributionList1 & OU name is Container1



I have written the below code to fetch the list of members to get individual member details & add it to my Member collection object
public void GetDLMembers() 

{ 

string _displayName; 

string _givenName; 

string _mail; 

DirectorySearcher search; 

DirectoryEntry entry; 

ArrayList listOfMatchingItems = new ArrayList(); 

entry = new DirectoryEntry("LDAP://my.domain.com/CN=DistributionList1,OU=Container1,DC=my,DC=domain,DC=com"); 

entry.AuthenticationType = AuthenticationTypes.Secure; 

search = new DirectorySearcher(entry); 

search.PropertiesToLoad.Add("mail"); 

search.PropertiesToLoad.Add("givenName"); 

search.PropertiesToLoad.Add("displayName"); 

string _Name; 

SearchResultCollection searchResults = search.FindAll(); 

foreach (SearchResult result in searchResults) 

{ 

foreach (String objName in result.GetDirectoryEntry().Properties["member"]) 

{ 

int selIndex = objName.IndexOf("CN=") + 3; 

int selEnd = objName.IndexOf(",OU") - 3; 

_Name = objName.Substring(selIndex, selEnd).Replace("\\", ""); 

DirectorySearcher dsSearch = new DirectorySearcher(entry); 

dsSearch.Filter = "CN=" + _Name; 

SearchResultCollection searchResults1 = dsSearch.FindAll(); 

foreach (SearchResult rs in searchResults1) 

{ 

_displayName = rs.Properties["displayName"][0].ToString(); 

_givenName = rs.Properties["givenName"][0].ToString(); 

_mail = rs.Properties["mail"][0].ToString(); 

... 

Logic to add it to the my customised collection object 

} 

} 

} 

}


For some reason the searchResults1 count is 0. Where its expected that the count for the searchResults1 collection should be 1. It will fetch the data of an account based on the CN. Any idea whats wrong in the code? Is there some thing wrong with the LDAP Path? Is there any better approach for accomplishing the functionality? If yes then any pointers to this will be very helpful.

Regards,
Vipul Mehta

QuestionException : Additional information: Required permissions cannot be acquired Pin
NICE TO MEET15-Oct-08 19:41
NICE TO MEET15-Oct-08 19:41 
AnswerRe: Exception : Additional information: Required permissions cannot be acquired Pin
Thomas Stockwell16-Oct-08 3:42
professionalThomas Stockwell16-Oct-08 3:42 
QuestionUsing reflection modify List<int> type class member...</int> [modified] Pin
chandrap15-Oct-08 17:13
chandrap15-Oct-08 17:13 
AnswerRe: Using reflection modify List type class member... Pin
chandrap16-Oct-08 3:54
chandrap16-Oct-08 3:54 
GeneralRe: Using reflection modify List type class member... Pin
chandrap16-Oct-08 4:24
chandrap16-Oct-08 4:24 
AnswerRe: Using reflection modify List type class member... Pin
led mike16-Oct-08 4:41
led mike16-Oct-08 4:41 
GeneralRe: Using reflection modify List type class member... Pin
chandrap16-Oct-08 4:50
chandrap16-Oct-08 4:50 
QuestionRe: Using reflection modify List type class member... Pin
led mike16-Oct-08 5:34
led mike16-Oct-08 5:34 
AnswerUsing reflection modify Generic type List<int> class member...</int> Pin
chandrap16-Oct-08 5:49
chandrap16-Oct-08 5:49 
QuestionSimulation in c# Pin
Sareh khanoom15-Oct-08 5:59
Sareh khanoom15-Oct-08 5:59 
AnswerRe: Simulation in c# Pin
Dave Kreskowiak15-Oct-08 7:08
mveDave Kreskowiak15-Oct-08 7:08 
QuestionDataTable PrimaryKey problem Pin
calhuskerfan14-Oct-08 11:54
calhuskerfan14-Oct-08 11:54 
AnswerRe: DataTable PrimaryKey problem Pin
led mike15-Oct-08 5:01
led mike15-Oct-08 5:01 
GeneralRe: DataTable PrimaryKey problem Pin
calhuskerfan15-Oct-08 9:17
calhuskerfan15-Oct-08 9:17 
QuestionRe: DataTable PrimaryKey problem Pin
led mike15-Oct-08 9:58
led mike15-Oct-08 9:58 
AnswerRe: DataTable PrimaryKey problem Pin
calhuskerfan15-Oct-08 10:03
calhuskerfan15-Oct-08 10:03 
AnswerRe: DataTable PrimaryKey problem Pin
calhuskerfan15-Oct-08 10:17
calhuskerfan15-Oct-08 10:17 

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.