Hi Thom,
Based on my understanding, you want to certain user account's user name and
organization name in C#.
There are many ways to get a user account's name, such as:
1. Using WMI to query Win32_UserAccount class's Name or FullName property.
2. Using WindowsIdentity.GetCurrent().Name property(Just as Jiachuan
stated)
I think the second way is much easier for you.
To access the Organization name, I think you should get it through ADSI.
First, you may get the your user account's DirectoryEntry object, then you
can refer the "Organization Name" through "Organization" attribute. Because
"Organization"'s displayname is "o", you can just do like this:
DirectoryEntry usr =new DirectoryEntry("LDAP://CN=New
User,CN=users,DC=fabrikam,DC=com");
string val = (string) usr.Properties["o"].Value;
For more sample and information, please refer to:
http://msdn.microsoft.com/library/de...us/sds/sds/use
r_management.asp
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.