blake_griffin
blake_griffin

Reputation: 119

How to obtain the short domain name from the User principal name (UPN)

I am trying to obtain the short domain name from the user principal name (UPN). Basically I have a user: [email protected]

I know windows maps this to the short domain name of: Artboard\blakegriffin

Is there a Windows API function that I can call whereby I supply the UPN ([email protected]) and retrieve the short domain name(Artboard\blakegriffin) ?

Upvotes: 0

Views: 3471

Answers (2)

blake_griffin
blake_griffin

Reputation: 119

Found this API call:

https://msdn.microsoft.com/en-us/library/ms725484(v=vs.85).aspx enter image description here

It's resolved the issue.

Upvotes: 0

Sa Yang
Sa Yang

Reputation: 9411

If I understand correctly , you want to get the Down-Level Logon Name from the UPN with some tools like API,right?

On Azure AD,there is no Attributes of NetBIOS Name in Azure AD.So you cannot reach that.

On local AD,as I known, there is no such way to obtain Down-level logon Name directly from User Principle Name.

The down-level logon name format is used to specify a domain and a user account in that domain, for example, DOMAIN\UserName. This DOMAIN is a NetBIOS domain name.

User principal name (UPN) format is used to specify an Internet-style name, such as [email protected]. This UPN suffix. Also known as the domain name.

So, you need to know that whether the NetBIOS domain name is compatible with the UPN suffix.Then you can confirm your Down-Level Logon Name.

See more details about User Name Formats in this document.


If you just want to obtain SAM Account after joining Azure AD DS, there is a way to get the SAM Account using Email address on local AD. See more details about how to get SAM account from Email Address, in this post.

There isn't a way to get this on Azure AD either.

Upvotes: 0

Related Questions