Share via

userType field returns an empty string even after using select

ghazzal jastaniah 51 Reputation points
2021-08-05T05:55:40.863+00:00

After authenticating the user and now the user is signed in I am trying to retrieve the userType from the graph client. I know that field is not a default value so I used select however it still does not work. I am making an android app on android studio using java. Here is the piece of code that I used.

 graphClient.me()
                .buildRequest().select("displayName,userType")
                .get(new ICallback<User>(){


                         @Override
                         public void success(User user) {
                           //displayGraphResult(user.getRawObject());
                           logTextView.setText(user.userType);
                         }

                         @Override
                         public void failure(ClientException ex) {
                             displayError(ex);
                         }
                     });
Microsoft Security | Microsoft Graph

Answer accepted by question author
  1. JosephXu-MSFT 531 Reputation points
    2021-08-11T06:00:44.77+00:00

    You can use following query in graph explorer , then compare the results of the query with the results in the SDK.

    https://graph.microsoft.com/v1.0/me?$select=displayName,userType
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.