microsoftgraph / microsoftgraph/msgraph-sdk-dotnet
Querystring Select option is missing during PostAsync() with v5 SDK
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 789
- Forks
- 264
- Avg merge
- 15h 17m
- Merged PRs (30d)
- 3
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Users.PostAsync(user) entry point and its request configuration, then compare it with the v4 Users.Request().Select(...).AddAsync flow described in the issue. Determine where query parameters could be supplied for the POST request and verify that a single call returns the selected fields, including mailNickname.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100