'Written: November 08, 2010
'Author: Leith Ross
'Summary: This class is used with the Get_User_Domain_API module.
'UnknownName - An unknown name type.
'
'FullyQualifiedDN - The fully-qualified distinguished name (for example, CN=Jeff Smith,OU=Users,DC=Engineering,DC=Microsoft,DC=Com).
'
'SamCompatibleName - A legacy account name (for example, Engineering\JSmith). The domain-only version includes trailing backslashes (\\).
'
'DisplayName - A "friendly" display name (for example, Jeff Smith). The display name is not necessarily the defining relative distinguished name (RDN).
'
'UniqueIdName - A GUID string that the IIDFromString function returns (for example, {4fa050f0-f561-11cf-bdd9-00aa003a77b6}).
'
'CanonicalName - The complete canonical name (for example, engineering.microsoft.com/software/someone). The domain-only version includes a trailing forward slash (/).
'
'UserPrincipalName - The user principal name (for example, someone@example.com).
'
'CanonicalExName - The same as NameCanonical except that the rightmost forward slash (/) is replaced with a new line character (\n), even in a domain-only case (for example, engineering.microsoft.com/software\nJSmith).
'
'ServicePrincipalName - The generalized service principal name (for example, www/www.microsoft.com@microsoft.com).
'
'DnsDomainName - The DNS domain name followed by a backward-slash and the SAM user name.
Private Const pvtUnKnownName = 0&
Private Const pvtFullyQualifiedDistinguishedName = 1&
Private Const pvtSamCompatibleName = 2&
Private Const pvtDisplayName = 3&
Private Const pvtUniqueIDName = 6&
Private Const pvtCanonicalName = 7&
Private Const pvtUserPrincipalName = 8&
Private Const pvtCanonicalNameEx = 9&
Private Const pvtServicePrincipalName = 10&
Private Const pvtDnsDomainName = 12&
Property Get UnKnownName() As Long
UnKnowName = pvtUnKnowName
End Property
Property Get FullyQualifiedDistinguishedName() As Long
FullyQualifiedDistinguishedName = pvtFullyQualifiedDistinguishedName
End Property
Property Get SamCompatibleName() As Long
SamCompatibleName = pvtSamCompatibleName
End Property
Property Get DisplayName() As Long
DisplayName = pvtDisplayName
End Property
Property Get UniqueIDName() As Long
UniqueIDName = pvtUniqueIDName
End Property
Property Get CanonicalName() As Long
CanonicalName = pvtCanonicalName
End Property
Property Get UserPrincipalName() As Long
UserPrincipalName = pvtUserPrincipalName
End Property
Property Get CanonicalNameEx() As Long
CanonicalNameEx = pvtCanonicalNameEx
End Property
Property Get ServicePrincipalName() As Long
ServicePrincipalName = pvtServicePrincipalName
End Property
Property Get DnsDomainName() As Long
DnsDomainName = pvtDnsDomainName
End Property
Function GetNameFormatString(ByVal NameFormat As Long) As String
Select Case NameFormat
Case 0: GetNameFormatString = "Unknown Name"
Case 1: GetNameFormatString = "Fully Qualified Distinguished Name"
Case 2: GetNameFormatString = "SAM Compatible Name"
Case 3: GetNameFormatString = "Display Name"
Case 6: GetNameFormatString = "Unique ID Name"
Case 7: GetNameFormatString = "Canonical Name"
Case 8: GetNameFormatString = "User Principal Name"
Case 9: GetNameFormatString = "Canonical Name Extended"
Case 10: GetNameFormatString = "Service Principal Name"
Case 12: GetNameFormatString = "DNS Domain Name"
End Select
End Function