microsoftgraph / microsoftgraph/msgraph-sdk-dotnet

graphClient.Me.GetAsync() / graphClient.Users.GetAsync() can't get AdditonalData from Type "#Collection(String)"

Open
#2,913 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:bug
Dominant language
C#
Stars
789
Forks
264
Avg merge
15h 17m
Merged PRs (30d)
3

Description

Describe the bug

Hello,
I'm trying to retrieve some Entra ID directory extensions from users using the Graph SDK. It works with normal strings, but if I have an array as data type, it just displays an empty object.

If I use the following code block:

var me = await graphClient.me.GetAsync(requestConfiguration =>
{
    requestConfiguration.QueryParameters.Select =
        new string[] { "Id", "extension_c4eaf7e0c68a468c8a93aa91dc1cdf8e_roomNumber", "extension_c4eaf7e0c68a468c8a93aa91dc1cdf8e_info" };
});

I receive:

{
    "AdditionalData": {
        "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(id,extension_c4eaxxxxxxxxxxxxxxxxaa91dc1cdf8e_roomNumber,extension_c4eaxxxxxxxxxxxxxxxxaa91dc1cdf8e_info)/$entity",
        "extension_c4eaxxxxxxxxxxxxxxxxaa91dc1cdf8e_roomNumber@odata.type": "#Collection(String)",
        "extension_c4eaxxxxxxxxxxxxxxxxaa91dc1cdf8e_roomNumber": {},
        "extension_c4eaxxxxxxxxxxxxxxxxaa91dc1cdf8e_info": "11 IT 04 Anwendungsdienste - Kollaboration"
    },
    "BackingStore": {
        "InitializationCompleted": true,
        "ReturnOnlyChangedValues": false
    },
    "Id": "c959de31-XXXX-XXXX-XXXX-276f63552369",
    "OdataType": "#microsoft.graph.user"
}
Expected behavior

I expect all the values to be displayed as if I go directly to the HTTP API.
URL: https://graph.microsoft.com/v1.0/me?$select=id,extension_c4eaxxxxxxxxxxxxxxxxaa91dc1cdf8e_roomNumber,extension_c4eaxxxxxxxxxxxxxxxxaa91dc1cdf8e_info

Output:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(id,extension_c4eaxxxxxxxxxxxxxxxxaa91dc1cdf8e_roomNumber,extension_c4eaxxxxxxxxxxxxxxxxaa91dc1cdf8e_info)/$entity",
    "id": "c959de31-XXXX-XXXX-XXXX-276f63552369",
    "extension_c4eaxxxxxxxxxxxxxxxxaa91dc1cdf8e_roomNumber@odata.type": "#Collection(String)",
    "extension_c4eaxxxxxxxxxxxxxxxxaa91dc1cdf8e_roomNumber": [
        "E.6.160"
    ],
    "extension_c4eaxxxxxxxxxxxxxxxxaa91dc1cdf8e_info": "11 IT 04 Anwendungsdienste - Kollaboration"
}
How to reproduce
var graphClient = new GraphServiceClient(credential, scopes);
var me = await graphClient.Me.GetAsync(requestConfiguration => {
    requestConfiguration.QueryParameters.Select =  new string[] { "Id", "extension_c4eaxxxxxxxxxxxxxxxxaa91dc1cdf8e_roomNumber", "extension_c4eaxxxxxxxxxxxxxxxxaa91dc1cdf8e_info" };
});
Console.WriteLine(JsonSerializer.Serialize(me!));
SDK Version

5.78.0

Latest version known to work for scenario above?

5.46.0

Known Workarounds

No response

Debug output

No response

Configuration

-OS: Windows 11
-Architecture: x64
-IDE: Visual Studio 2022 17.14.0

Other information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the GraphServiceClient.Me.GetAsync reproduction in the issue and compare behavior between SDK versions 5.46.0 and 5.78.0. Trace how the selected extension field marked #Collection(String) is deserialized into AdditionalData. Done means the SDK preserves the returned string array instead of producing an empty object.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.