Click here to Skip to main content
15,908,841 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,

I’m trying to write a programme that will show the values of attributes of user’s accounts in AD. Obviously strings and ints can just be shown as a string but i was looking for a way to determine the datatype first so it could be converted into a string - such as a large integer, octet string UTC time etc.
Any ideas on how i can query for the datatype?

Many Thanks,
Phil
Posted

All object has the .GetType() function, that returns a Type class and there by the type.

Perhaps this can help ?

Howto: (Almost) Everything In Active Directory via C#[^]

Try take a look at TypeDescriptor class and the function GetConverter and ConvertToString.
 
Share this answer
 
v3
Comments
Dylan Morley 11-Apr-11 7:24am    
yeah good article, I still refer to that!
Hi Kim,

that doesn't work, but i think i have found my own answer:

C++
ActiveDirectorySchema ass = ActiveDirectorySchema.GetCurrentSchema();
ActiveDirectorySchemaClass u = ass.FindClass("person");

foreach (ActiveDirectorySchemaProperty a in u.GetAllProperties())
{
   Console.WriteLine(a.CommonName + " : " + a.Syntax);
}


i needed the "Syntax" so i could then know how to convert the data.

thank for your help

Phil
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900