4.1.4.2.24 ConstructOutput

 procedure ConstructOutput(
   obj: DSName,
   formatDesired: DWORD): set of unicodestring

Informative summary of behavior: ConstructOutput is a helper function that constructs the name of the object in the required output format. Note that the returned set of values might be empty or might contain more than one value. These situations are handled by the caller function, LookupName (section 4.1.4.2.10).

  
 if formatDesired = DS_FQDN_1779_NAME then
   return {obj!distinguishedName}
 else if formatDesired = DS_NT4_ACCOUNT_NAME then
   if obj!sAMAccountName ≠ null then
     return {DomainNetBIOSNameFromDomain(GetObjectNC(obj)) + "\" +
           obj!sAMAccountName}
   else if IsDomainOnly(obj) then
     return {DomainNetBIOSNameFromDomain(GetObjectNC(obj)) + "\"}
 else if formatDesired = DS_USER_PRINCIPAL_NAME then
   return {obj!userPrincipalName}
 else if formatDesired = DS_CANONICAL_NAME then
   return {GetCanonicalName(obj, false)}
 else if formatDesired = DS_UNIQUE_ID_NAME then
   return {GuidToString(obj!objectGUID)}
 else if formatDesired = DS_DISPLAY_NAME then
   return {obj!displayName}
 else if formatDesired = DS_SERVICE_PRINCIPAL_NAME then
   return obj!servicePrincipalName
 else if formatDesired = DS_CANONICAL_NAME_EX then
   return {GetCanonicalName(obj, true)}
 else if formatDesired = DS_STRING_SID_NAME then
   return {StringSidFromSid(obj!objectSid)}
 else if formatDesired = DS_USER_PRINCIPAL_NAME_FOR_LOGON then
   /* If UPN is set, then return it. */
   if obj!userPrincipalName ≠ null then
     return {obj!userPrincipalName}
   endif
   return {obj!sAMAccountName + "@" + 
     DomainDNSNameFromDomain(GetObjectNC(obj))}
 endif
  
 /* Otherwise, unknown format. */
 return null
Show: