Click here to Skip to main content
15,899,026 members
Home / Discussions / C#
   

C#

 
QuestionHow to maximize the main form at load time? Pin
sinosoidal23-Mar-07 6:17
sinosoidal23-Mar-07 6:17 
AnswerRe: How to maximize the main form at load time? Pin
Christian Graus23-Mar-07 6:35
protectorChristian Graus23-Mar-07 6:35 
AnswerRe: How to maximize the main form at load time? Pin
Saira Tanwir23-Mar-07 6:39
Saira Tanwir23-Mar-07 6:39 
GeneralRe: How to maximize the main form at load time? Pin
sinosoidal23-Mar-07 6:41
sinosoidal23-Mar-07 6:41 
QuestionHow to show a "Process with ..." entry in the File-Explorer context menu Pin
AlexZieg7123-Mar-07 6:14
AlexZieg7123-Mar-07 6:14 
AnswerRe: How to show a "Process with ..." entry in the File-Explorer context menu Pin
Stefan Troschuetz23-Mar-07 11:01
Stefan Troschuetz23-Mar-07 11:01 
GeneralRe: How to show a "Process with ..." entry in the File-Explorer context menu Pin
AlexZieg7123-Mar-07 12:47
AlexZieg7123-Mar-07 12:47 
QuestionActive Directory access Pin
Talal Sultan23-Mar-07 4:49
Talal Sultan23-Mar-07 4:49 
Hi,

I have a small windows application that connects to the local directory and retrieves the list of users. Then, it is possible to display the data of the user by clicking on a button. I use LDAP://DomainName to connect and things "seem" to be working fine. I manage to get the different data of the user I select (name, country, address, email, phone etc...) however I am having a problem with the "memberof" property. For some users, I am able to retrieve the list of groups he belongs to but for other users the property returns an empty collection. I am using the following piece of code:

<br />
 SearchResultCollection src = ds.FindAll();<br />
 SearchResult sr = src[0]; // I am filtering per username so only one match possible<br />
 ResultPropertyValueCollection memberOf = sr.Properties["memberOf"]; // this sometimes returns zero items<br />
 ResultPropertyValueCollection givenName = sr.Properties["givenName"];<br />
 ResultPropertyValueCollection lastName = sr.Properties["sn"];<br />
 ResultPropertyValueCollection email = sr.Properties["mail"];<br />
 ResultPropertyValueCollection address = sr.Properties["homePostalAddress"];<br />
 ResultPropertyValueCollection zip = sr.Properties["postalCode"];<br />
 ResultPropertyValueCollection country = sr.Properties["co"];<br />
 ResultPropertyValueCollection title = sr.Properties["title"];<br />
 ResultPropertyValueCollection city = sr.Properties["l"];<br />
 ResultPropertyValueCollection state = sr.Properties["st"];<br />
 ResultPropertyValueCollection phone = sr.Properties["telephoneNumber"];<br />
 ResultPropertyValueCollection otherPhone = sr.Properties["otherTelephone"];<br />
 ResultPropertyValueCollection fax = sr.Properties["facsimileTelephoneNumber"];<br />


Then I filter the memberof collection like this:

<br />
 foreach (object role in memberOf)<br />
            {<br />
                string[] roleItems = role.ToString().Split(',');<br />
                foreach (string temp in roleItems)<br />
                {<br />
                    int i = temp.IndexOf("CN=");<br />
                    if (i >= 0) // found string<br />
                    {<br />
                        listGroups.Items.Add(temp.Substring(3));<br />
                    }<br />
                }<br />
            }<br />


This will give me the group name. I have tried displaying the whole "role" string without parsing, I thought maybe my parsing was not complete, but I didn't get anything either.

I am new in Active Directory stuff and I have no idea if there is another way to do things.

Any help would be greatly appreciated.

Talal


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook

QuestionWeb, Dynamically Gridview creating Eventhandling Pin
peter.bellen@qsm-europe.com23-Mar-07 4:04
peter.bellen@qsm-europe.com23-Mar-07 4:04 
QuestionPrinting option Pin
netJP12L23-Mar-07 4:02
netJP12L23-Mar-07 4:02 
QuestionHelp with binding combo box and datarow column Pin
Matthew Cuba23-Mar-07 3:59
Matthew Cuba23-Mar-07 3:59 
AnswerRe: Help with binding combo box and datarow column Pin
joon vh.23-Mar-07 4:47
joon vh.23-Mar-07 4:47 
AnswerRe: Help with binding combo box and datarow column [modified] Pin
Zoltan Balazs23-Mar-07 5:49
Zoltan Balazs23-Mar-07 5:49 
AnswerRe: Help with binding combo box and datarow column Pin
Seishin#23-Mar-07 5:53
Seishin#23-Mar-07 5:53 
Questionhow to load web page Pin
Saira Tanwir23-Mar-07 3:28
Saira Tanwir23-Mar-07 3:28 
AnswerRe: how to load web page Pin
MoustafaS23-Mar-07 3:31
MoustafaS23-Mar-07 3:31 
GeneralRe: how to load web page Pin
joon vh.23-Mar-07 4:44
joon vh.23-Mar-07 4:44 
GeneralRe: how to load web page Pin
Saira Tanwir23-Mar-07 6:34
Saira Tanwir23-Mar-07 6:34 
QuestionListview control flckering in .NET 2.0 Pin
pliu_200023-Mar-07 3:27
pliu_200023-Mar-07 3:27 
AnswerRe: Listview control flckering in .NET 2.0 Pin
sharad subedi14-Aug-11 18:36
sharad subedi14-Aug-11 18:36 
QuestionGlobal mutex under NT4 [Answered] Pin
Dan Neely23-Mar-07 3:19
Dan Neely23-Mar-07 3:19 
QuestionPOS Application Pin
Waskira23-Mar-07 3:15
Waskira23-Mar-07 3:15 
AnswerRe: POS Application Pin
joon vh.23-Mar-07 3:21
joon vh.23-Mar-07 3:21 
GeneralRe: POS Application Pin
Waskira23-Mar-07 3:55
Waskira23-Mar-07 3:55 
GeneralRe: POS Application Pin
joon vh.23-Mar-07 4:05
joon vh.23-Mar-07 4:05 

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.