Last post Mar 18, 2009 08:00 AM by Stu_Pittwood
Mar 18, 2009 04:58 AM|Stu_Pittwood|LINK
Firstly let me stress I'm no developer .... just have a one off peice of code to write! I have to write some code which will work out who the currently logged on user is & then connect to AD & pull out the surname & firstname. I think I'm nearly there,
this is what I have so far:
'Determine Exact UserName
DefaultNamingContext = RootDSE.Properties(
Surname = Results(1).ToString
Now, it seems to know who I am, it correctly pulls out my username, which I then split on the \ and pass that into my directory searcher filter. when I look at the content of 'Results' I see that there is a count of one (which presumably means it's found
me in AD??)
When I try to write out what's in position 1 of the results collection I get the following exception:
"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"
Can anyone give me any pointers .... it's driving me mental & I'm going around in circles!
Thanks in advance.
Mar 18, 2009 08:00 AM|Stu_Pittwood|LINK