Click here to Skip to main content
15,915,702 members
Home / Discussions / C#
   

C#

 
GeneralC# Code Editor - recommendations [modified] Pin
User of Users Group28-Dec-07 5:27
User of Users Group28-Dec-07 5:27 
GeneralRe: C# Code Editor - recommendations Pin
Ed.Poore28-Dec-07 5:51
Ed.Poore28-Dec-07 5:51 
GeneralRe: C# Code Editor - recommendations Pin
User of Users Group28-Dec-07 7:08
User of Users Group28-Dec-07 7:08 
GeneralRe: C# Code Editor - recommendations Pin
Daniel Grunwald28-Dec-07 8:12
Daniel Grunwald28-Dec-07 8:12 
GeneralRe: C# Code Editor - recommendations Pin
TJoe28-Dec-07 9:38
TJoe28-Dec-07 9:38 
GeneralRe: C# Code Editor - recommendations Pin
User of Users Group28-Dec-07 12:00
User of Users Group28-Dec-07 12:00 
GeneralRe: C# Code Editor - recommendations Pin
Ed.Poore28-Dec-07 12:33
Ed.Poore28-Dec-07 12:33 
Generalplease delete thread.... Pin
shwaguy28-Dec-07 4:52
shwaguy28-Dec-07 4:52 
After 3 hours of frustration I need some help with the findOne() method. FindAll() is no problem but after gong through and trying findOne() code I have only gotten one to work all the others fail (including the one on this site: http://www.codeproject.com/KB/system/QueryADwithDotNet.aspx[^]. The problem seems to be with the search filter, I have to set it to "samaccountname":

<br />
                     DirectorySearcher search = new DirectorySearcher();<br />
                     //this filter works<br />
                     search.Filter = "samaccountname=" + userName;<br />
<br />
                     //This below formats for the search filter result in result=null<br />
<br />
                     //search.Filter = String.Format("(cn={0})", userName); //code project filter<br />
                     //search.Filter = "cn=" + userName;<br />
<br />
                     search.PropertiesToLoad.Add("memberOf");<br />
                     StringBuilder groupsList = new StringBuilder();<br />
                     SearchResult result = search.FindOne();<br />
                     if (result != null)<br />
                     {<br />
                         int groupCount = result.Properties["memberOf"].Count;<br />
<br />
                         for (int counter = 0; counter < groupCount; counter++)<br />
                         {<br />
                             groupsList.Append((string)result.Properties["memberOf"][counter]);<br />
                             groupsList.Append("|");<br />
                         }<br />
                     }<br />
                     else<br />
                     {<br />
                         MessageBox.Show("not found");<br />
                     } 



help!!!

shwaguy

modified on Friday, December 28, 2007 12:37:58 PM

GeneralRe: directorysearcher findone() Pin
KaptinKrunch28-Dec-07 5:03
KaptinKrunch28-Dec-07 5:03 
GeneralRe: directorysearcher findone() Pin
shwaguy28-Dec-07 5:59
shwaguy28-Dec-07 5:59 
GeneralRe: directorysearcher findone() Pin
KaptinKrunch28-Dec-07 6:18
KaptinKrunch28-Dec-07 6:18 
GeneralRe: directorysearcher findone() Pin
Not Active28-Dec-07 6:07
mentorNot Active28-Dec-07 6:07 
GeneralRe: directorysearcher findone() Pin
shwaguy28-Dec-07 6:17
shwaguy28-Dec-07 6:17 
GeneralRe: directorysearcher findone() Pin
Not Active28-Dec-07 6:23
mentorNot Active28-Dec-07 6:23 
GeneralRe: directorysearcher findone() Pin
shwaguy28-Dec-07 6:38
shwaguy28-Dec-07 6:38 
GeneralRe: directorysearcher findone() Pin
Not Active28-Dec-07 6:40
mentorNot Active28-Dec-07 6:40 
GeneralRe: directorysearcher findone() Pin
shwaguy28-Dec-07 7:32
shwaguy28-Dec-07 7:32 
GeneralRe: directorysearcher findone() Pin
Not Active28-Dec-07 7:51
mentorNot Active28-Dec-07 7:51 
GeneralRe: directorysearcher findone() Pin
shwaguy28-Dec-07 8:37
shwaguy28-Dec-07 8:37 
AnswerRe: directorysearcher findone() ---still seeking solutio Pin
KaptinKrunch28-Dec-07 6:33
KaptinKrunch28-Dec-07 6:33 
GeneralRe: directorysearcher findone() ---still seeking solutio Pin
shwaguy28-Dec-07 6:47
shwaguy28-Dec-07 6:47 
GeneralRe: please delete thread.... Pin
Paul Conrad28-Dec-07 6:56
professionalPaul Conrad28-Dec-07 6:56 
GeneralRe: please delete thread.... Pin
shwaguy28-Dec-07 7:07
shwaguy28-Dec-07 7:07 
GeneralRe: please delete thread.... Pin
Not Active28-Dec-07 7:25
mentorNot Active28-Dec-07 7:25 
GeneralRe: please delete thread.... Pin
shwaguy28-Dec-07 7:34
shwaguy28-Dec-07 7:34 

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.