Monday, June 3, 2024
58
rated 0 times [  61] [ 3]  / answers: 1 / hits: 37537  / 7 Years ago, fri, january 12, 2018, 12:00:00

We have an application which has used a local AD to fetch user info. Some customers want to move to the cloud and are using Azure AD. We extended the app to sign users in via owin and now we're fetching users via Microsoft Graph.


However from Microsoft Graph we do not get full user profiles. We want to fetch all properties on users, not just the basic ones.


var client = new RestClient(string.Format("https://graph.microsoft.com/v1.0/users/{0}", userEmail));
request = new RestRequest();
request.Method = Method.GET;
request.AddHeader("Authorization", _token.Token);
var reponse = client.Execute(request);

This only gives me some information though, for example I don't get 'Department' from this.
Is it possible to configure in azure what should be returned here, if so then where? Or do I need something other than /users/?


Different customers might have different special properties that need to be fetched. So the best solution would be to have an endpoint to call and get everything, including special properties not standard in azure ad. After that I can parse it on my side. Is this possible?


The app has permission to read both basic and full profiles. Do I need something more?


More From » azure-active-directory

 Answers
30

That's the normal behaviour of Graph API, see documentation here and this extract:



By default, only a limited set of properties are returned (
businessPhones, displayName, givenName, id, jobTitle, mail,
mobilePhone, officeLocation, preferredLanguage, surname,
userPrincipalName).


To return an alternative property set, you must specify the desired
set of user properties using the OData $select query parameter. For
example, to return displayName, givenName, and postalCode, you would
use the add the following to your query
$select=displayName,givenName,postalCode



You have to specify all fields in the select, as $select=* will only output the key fields in Graph API implementation.


So you will not be able to get what you ask (variable custom fields).


More info on the fields of User can be found here


[#55474] Tuesday, January 9, 2018, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kenyonc

Total Points: 235
Total Questions: 106
Total Answers: 125

Location: Bangladesh
Member since Sat, Jan 23, 2021
3 Years ago
;