If you have not used it I would check out the graph explorer
https://developer.microsoft.com/en-us/graph/graph-explorer
If I had to take a guess it is a dynamic column based on userPrincipalName. If the user is from an external system there will be #EXT# in the userPrincipalName. I would look at that and see if there is something different about them.
I was looking at the endpoint https://graph.microsoft.com/v1.0/users
As a comment from Hury mentions, you could use userType and externalUserState to probably determine the same thing.
if I was doing this in c# (This is from memory sorry if there is a typo)
public string Source {
get {
return UserPrincipalName.Contains("#EXT#")?"Microsoft Account":"Azure Active Directory";
}
}
For more complex processing
private string _source = null;
public string Source _source??(_source=GenerateSource());
}
protected string GenerateSource(){
return UserPrincipalName.Contains("#EXT#")?"Microsoft Account":"Azure Active Directory";
}
If I was using code similar to what can be found here
MS Graph - LINQ query returning incorrect results
I would do it as extension class (not tested all from memory, but I should be close)
public static class UserExtension{
public static UserSource(this User user){
var userTypeUpper = _user.UserType.ToUpperCase();
var userPrincipalNameUpper = user.UserPrincipalName.ToUpperCase();
var externalUserStateUpper = user.ExternalUserState.ToUpperCase();
return (_user.UserType == "MEMBER" && userPrincipalNameUpper.Contains("#EXT#") == false) ? "Azure Active Directory" :
(userTypeUpper == "MEMBER" && userPrincipalNameUpper.Contains("#EXT#")) ? "Microsoft Account" :
(userTypeUpper == "GUEST" && externalUserStateUpper == "ACCEPTED") ? "External Azure Active Directory" :
(userTypeUpper == "GUEST" && externalUserStateUpper == "PENDINGACCEPTANCE") ? "Invited user" : "Unknown";
}
}
//sample code using it
Microsoft.Graph.IGraphServiceUsersCollectionPage users = await graphClient.Users.Request()
.Select("displayName, userPrincipalName, userType")
.GetAsync();
List<User> lstUsers = (List<User>)users.CurrentPage.ToList();
var source = lstUsers.First().UserSource()