msgraph-sdk-dotnet icon indicating copy to clipboard operation
msgraph-sdk-dotnet copied to clipboard

Querystring Select option is missing during PostAsync() with v5 SDK

Open LockTar opened this issue 1 year ago • 1 comments

Describe the bug In SDK v4 we could do the following call:

var user = new(){...}
var result = await graphClient.Users.Request().Select("mailNickname").AddAsync(user);

This would create a new user with the fields defined in the user object. One of those fields is mailNickname. The result gave a User back with the fields from the AddAsync and extra selected mailNickname field.

With the new SDK we can't give Select QueryParameters parameters in the PostAsync method. In order to get the complete user again, we need to do 2 calls in the new v5 SDK.

var result = await graphClient
    .Users
    .PostAsync(user);

result = await graphClient
    .Users[result.Id]
    .GetAsync(rc =>
    {
        rc.QueryParameters.Select = new string[] { "id", "displayName", "mail", "mailNickname", "mobilePhone", "..." };
    });

How can we do this better/more optimized?

Expected behavior Want to do a Post with select in a single call just like in v4 of the SDK.

LockTar avatar Mar 23 '23 14:03 LockTar

Currently experiencing the same issue, we used to put select params in add async and now we can't

huideaki avatar Nov 01 '23 15:11 huideaki