Click here to Skip to main content
15,891,033 members
Home / Discussions / C#
   

C#

 
GeneralAdding picturebox [modified] Pin
netJP12L10-Mar-08 7:41
netJP12L10-Mar-08 7:41 
GeneralRe: Adding picturebox Pin
Judah Gabriel Himango10-Mar-08 8:01
sponsorJudah Gabriel Himango10-Mar-08 8:01 
GeneralRe: Adding picturebox Pin
netJP12L10-Mar-08 8:10
netJP12L10-Mar-08 8:10 
AnswerRe: Adding picturebox Pin
Eslam Afifi10-Mar-08 9:00
Eslam Afifi10-Mar-08 9:00 
QuestionHow to force DataGridView to Draw empty rows Pin
josip cagalj10-Mar-08 6:40
josip cagalj10-Mar-08 6:40 
AnswerRe: How to force DataGridView to Draw empty rows Pin
Eslam Afifi10-Mar-08 9:17
Eslam Afifi10-Mar-08 9:17 
GeneralRe: How to force DataGridView to Draw empty rows Pin
josip cagalj10-Mar-08 22:16
josip cagalj10-Mar-08 22:16 
Questionhow to get all properties of all users of ad [modified] Pin
stephan_00710-Mar-08 6:18
stephan_00710-Mar-08 6:18 
hi everyone!

i would like to get all active directory entries for all users.

i know how to get the name for all users in active directory for example.

so lets say a user has 50 entires in ad, then i do have to call them one by one using the property name e.g. "givenname" and so on.

i would like to create a two dimensional array which contains all infos for all users out of the ad.

but i have no clue how to get the property names into an array.

it should be something like this:

List < string > Propertylist = new List < string >();
(the spaces have to be removed in the braces but otherwise it won't show up here!)

Then convert them to an array and use them to write the property to a file. Something like that:

<br />
StreamWriter ConsoleFile = new StreamWriter("adproperty.txt");<br />
<br />
DirectoryEntry entry = new DirectoryEntry("LDAP://DOMAIN");<br />
DirectorySearcher DSearch = new DirectorySearcher(entry);<br />
<br />
DSearch.Filter = "(&(objectClass=user))"; // define a filter criterium<br />
<br />
// FILL PROPERTYLIST NAMES INTO ARRAY HERE<br />
<br />
foreach (SearchResult sResultSet in DSearch.FindAll())<br />
{<br />
  for (int i=0; i < propertylist.count; i++) <br />
{<br />
    string value = sResultSet.Properties[PropertyList[i]][0].ToString();<br />
    ConsoleFile.WriteLine(value);<br />
  }<br />
}<br />
ConsoleFile.Close();<br />


so value will pass through names like "givenname", "title", "company", "mail" etc.

and my array looks like this
user1,givenname
user1, title
.....
user2,givenname
user2,title
......
user3,givenname
etc.

Because otherwise I would have to add one line for each property by hand.
e.g. ConsoleFile.WriteLine(sResultSet.Properties["givenname"][0].ToString());

Does anyone have an idea, how to get all propertys (by name) into a string array to use it in a loop?
I found a way to get the number of them but i found no way to get their names into a string array.

Thanks!
Stephan.

modified on Monday, March 10, 2008 3:13 PM

AnswerRe: how to get all properties of all users of ad Pin
stephan_00711-Mar-08 4:09
stephan_00711-Mar-08 4:09 
QuestionWebBrowser email Pin
cechode10-Mar-08 6:03
cechode10-Mar-08 6:03 
QuestionHow to intercept Graphics.DrawString() method call Pin
njhy10-Mar-08 5:15
njhy10-Mar-08 5:15 
GeneralRe: How to intercept Graphics.DrawString() method call Pin
Judah Gabriel Himango10-Mar-08 7:09
sponsorJudah Gabriel Himango10-Mar-08 7:09 
GeneralRe: How to intercept Graphics.DrawString() method call Pin
njhy10-Mar-08 7:52
njhy10-Mar-08 7:52 
Questionwhat is the best way to store and search a huge file? Pin
cheq32610-Mar-08 5:01
cheq32610-Mar-08 5:01 
GeneralRe: what is the best way to store and search a huge file? Pin
PIEBALDconsult10-Mar-08 5:08
mvePIEBALDconsult10-Mar-08 5:08 
GeneralRe: what is the best way to store and search a huge file? Pin
Justin Perez10-Mar-08 5:10
Justin Perez10-Mar-08 5:10 
GeneralRe: what is the best way to store and search a huge file? Pin
Joe Woodbury10-Mar-08 9:39
professionalJoe Woodbury10-Mar-08 9:39 
GeneralRe: what is the best way to store and search a huge file? Pin
Bekjong10-Mar-08 5:10
Bekjong10-Mar-08 5:10 
GeneralRe: what is the best way to store and search a huge file? Pin
Scott Dorman10-Mar-08 5:11
professionalScott Dorman10-Mar-08 5:11 
GeneralRe: what is the best way to store and search a huge file? Pin
led mike10-Mar-08 5:21
led mike10-Mar-08 5:21 
GeneralRe: what is the best way to store and search a huge file? Pin
cheq32610-Mar-08 9:41
cheq32610-Mar-08 9:41 
GeneralRe: what is the best way to store and search a huge file? Pin
led mike10-Mar-08 10:00
led mike10-Mar-08 10:00 
QuestionHow do I get the value a cell in a datagrid Pin
Walaza10-Mar-08 3:51
Walaza10-Mar-08 3:51 
AnswerRe: How do I get the value a cell in a datagrid Pin
mark_w_10-Mar-08 5:19
mark_w_10-Mar-08 5:19 
AnswerRe: How do I get the value a cell in a datagrid Pin
Eslam Afifi10-Mar-08 8:43
Eslam Afifi10-Mar-08 8:43 

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.