Click here to Skip to main content
16,005,037 members
Home / Discussions / C#
   

C#

 
QuestionRe: Delegate Question Pin
Programm3r10-Jan-08 3:40
Programm3r10-Jan-08 3:40 
GeneralRe: Delegate Question Pin
Luc Pattyn10-Jan-08 4:43
sitebuilderLuc Pattyn10-Jan-08 4:43 
GeneralStoring hexadecimal values in XML Pin
Tiger45610-Jan-08 3:02
Tiger45610-Jan-08 3:02 
GeneralRe: Storing hexadecimal values in XML Pin
Skippums10-Jan-08 5:02
Skippums10-Jan-08 5:02 
GeneralProgramatically discover the version of a pdf file Pin
Neophyte3010-Jan-08 2:49
Neophyte3010-Jan-08 2:49 
GeneralRe: Programatically discover the version of a pdf file Pin
Luc Pattyn10-Jan-08 3:39
sitebuilderLuc Pattyn10-Jan-08 3:39 
GeneralRe: Programatically discover the version of a pdf file [modified] Pin
Neophyte3010-Jan-08 6:00
Neophyte3010-Jan-08 6:00 
QuestionSearching the properties in the Active Directory Pin
khuzwayom10-Jan-08 2:18
khuzwayom10-Jan-08 2:18 
Happy New Year Everyone!

Please help I am writing a code that searches the Active directory, it first get the list of properties, then use each property name to get its value. I filter the directory searcher by the cn. My problem is that for some people the search doesn't return the "mail" property, this is the property I need most. Please find my code snippet below.

DirectoryEntry de = new DirectoryEntry("LDAP://" + "AFLIFEDC04",
@"aflife\alsql", "perseus", AuthenticationTypes.FastBind);
string[] propertiesFound;
string Email = "";
DirectorySearcher ds = new DirectorySearcher(de);

//Use the users full name to get the email address from directory services
ds.Filter = "(cn=" + FullName + ")";
ds.SearchScope = SearchScope.Subtree;
try
{
SearchResultCollection results = ds.FindAll();
foreach (SearchResult result in results)
{
int a = 0;
ResultPropertyCollection propc = result.Properties;
DirectoryEntry dey = result.GetDirectoryEntry();

propertiesFound = new string[propc.Count];
// Loading all the properties return into the propertieFound array
foreach (string propertyName in propc.PropertyNames)
{
//This where the problem is, for some I get like 38 properties,
//for others I get 34. What is the cause of and what is the
//solution to it.
propertiesFound[a] = propertyName;
a++;
}
}
}
Thank you in advanced for your solutions.

Kind Regards
Mpumelelo KhuzwayoConfused | :confused:

khuzym

GeneralRe: Searching the properties in the Active Directory Pin
Justin Perez10-Jan-08 3:37
Justin Perez10-Jan-08 3:37 
GeneralRe: Searching the properties in the Active Directory Pin
khuzwayom10-Jan-08 20:02
khuzwayom10-Jan-08 20:02 
Generalexcel file export Pin
Member 475670910-Jan-08 2:08
Member 475670910-Jan-08 2:08 
GeneralRe: excel file export Pin
Justin Perez10-Jan-08 3:39
Justin Perez10-Jan-08 3:39 
QuestionIP Address Problem Pin
dipak.dipak10-Jan-08 1:43
dipak.dipak10-Jan-08 1:43 
GeneralRe: IP Address Problem Pin
half-life10-Jan-08 2:33
half-life10-Jan-08 2:33 
QuestionRe: IP Address Problem Pin
dipak.dipak10-Jan-08 2:52
dipak.dipak10-Jan-08 2:52 
GeneralRe: IP Address Problem Pin
Skippums10-Jan-08 5:14
Skippums10-Jan-08 5:14 
GeneralRe: IP Address Problem Pin
Dave Kreskowiak10-Jan-08 5:17
mveDave Kreskowiak10-Jan-08 5:17 
Generalmshtml.ihtmlelemrnt eventhandling Pin
balakpn10-Jan-08 1:38
balakpn10-Jan-08 1:38 
GeneralRe: mshtml.ihtmlelemrnt eventhandling Pin
Judah Gabriel Himango10-Jan-08 5:17
sponsorJudah Gabriel Himango10-Jan-08 5:17 
GeneralRe: mshtml.ihtmlelemrnt eventhandling Pin
balakpn10-Jan-08 19:51
balakpn10-Jan-08 19:51 
General[Message Deleted] Pin
michael_jhons10-Jan-08 1:38
michael_jhons10-Jan-08 1:38 
GeneralRe: delete or insert using datagrid Pin
Manoj G10-Jan-08 4:43
Manoj G10-Jan-08 4:43 
GeneralRe: delete or insert using datagrid Pin
michael_jhons10-Jan-08 22:44
michael_jhons10-Jan-08 22:44 
GeneralConvert "Yes" To Boolean Pin
StyleGuide10-Jan-08 1:14
StyleGuide10-Jan-08 1:14 
GeneralRe: Convert "Yes" To Boolean Pin
J4amieC10-Jan-08 1:26
J4amieC10-Jan-08 1:26 

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.