You won't find what you're looking for in the DirectoryEntry, unfortunately.
You have the sAMAccountName
which typically is something like myuser
(without the domain). You have the distinguishedName
which is something like LDAP://cn=joe myuser,cn=Users,dc=yourCompany,dc=com
. You also have a userPrincipalName
but that's usually a name in the format of [email protected]
.
But you won't find any attribute that has the domain\MyUser
in it, unfortunately. You'll have to put that together from your information about the domain name, and the sAMAccountName of the DirectoryEntry.
For more information and some excellent Excel sheets on all the LDAP and WinNT properties in System.DirectoryServices, check out the Hilltop Lab website by ADSI MVP Richard Mueller.
Marc