Why does $select not work on POST https://graph.microsoft.com/v1.0/users

Steffen Dyhr-Nielsen 1 Reputation point
2023-02-03T13:36:43.07+00:00

We are trying to confirm a succeeded user input (in one go for convienience), thus looking for specific properties (other than the default) and would expect the $select query parameter to work e.g.

POST https://graph.microsoft.com/v1.0/users?$select=id,mail returning the id and mail properties

To our suprise ALL properties are returned no matter what we put in the select parameter value so currently we are doing like this POST https://graph.microsoft.com/v1.0/users?$select=* just for readability

Is this a "feature" or an issue?

Cheers

Steffen

Microsoft Security Microsoft Graph
{count} votes

2 answers

Sort by: Most helpful
  1. Gopinath Chennamadhavuni 2,446 Reputation points
    2023-02-03T14:29:12.3233333+00:00

    Hi @Steffen Dyhr-Nielsen ,

    Hope you are doing well.

    As per the documentation, create user using MS graph API will not support any Odata query parameters.

    At a minimum, you must specify the required properties for the user. Based on the valid request payload it will create the new user and return the predefined property values in response irrespective of values mentioned in $select parameter of Request API.

    If you want, you can use OData query parameter $Select with Get method type.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    0 comments No comments

  2. CarlZhao-MSFT 46,371 Reputation points
    2023-02-06T07:36:14.9533333+00:00

    Hi @Steffen Dyhr-Nielsen

    Are you trying to list the id and mail attributes of all users in the tenant? If yes, then you should use the GET request:

    User's image

    You can also use the code:

    GraphServiceClient graphClient = new GraphServiceClient( authProvider );
    
    var users = await graphClient.Users
    	.Request()
    	.Select("id,mail")
    	.GetAsync();
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".


Your answer

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