'Why does "Microsoft.Graph.User.AdditionalData" property contain manager information?

Within the Microsoft.Graph.User object there is a field called "AdditionalData". It seems this can hold many values, from telling if a record is a delta record to storing manager information.

enter image description here

In this instance, it holds information on a users manager. It looks like it can hold multiple records however, so I am asking what is the best way to get data from this property, to ensure I get all values it might have.

I am also unsure why manager information is in the AdditionalData property and not in the Manager property.



Solution 1:[1]

Yes you are correct AdditionalData may hold multiple record,You can add additionalData to your user that can hold any information based on your customization.

you can add the multiple value to additionalData using Openxtension

Trick is to add the extensions like this

extension = new OpenTypeExtension
                {
                    ExtensionName = AzureADExtensions.UserConstants.ExtensionName,
                    AdditionalData = new Dictionary<string, object>
                    {
                        {"OtherEmail", externalUser.Email},
                        {"OtherRole" , externalUser.Roles.FirstOrDefault()}
                    }
                };

                await _graphClient.Users[user.Id].Extensions.Request()
                    .AddAsync(extension);

And then retrieve them like this.

user = await _graphClient
                    .Users[userId]
                    .Request()
                    .GetAsync();
// Note : you should be able to expand this on original request, but fails for me.
                var extensions = await _graphClient.Users[user.Id].Extensions.Request().GetAsync();
                user.Extensions = extensions;

Reference : Azure AD GraphServiceClient can't set AdditionalData against User

Solution 2:[2]

The "Additional Data" property only holds manager info if we do a delta query, if we do a regular query, we have to use extended properties to get the manager.

We are avoiding delta query for the moment in the interests of time but might come back to it at another point.

Thanks all.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RahulKumarShaw-MT
Solution 2 wilson_smyth