I am trying to receive a user from Microsoft Graph using the graphclient. the last property is an extended property that has been replicated across from on premise AD and i dont know how to reference it?
i can select the property using a normal url format Graph request using Graph Explorer so i know it is there, just not sure of the syntax using the graphclient?
var user = await graphClient.Me.Request()
.Select(u => new {
u.DisplayName,
u.Mail,
u.UserPrincipalName,
u.Department,
u.OnPremisesSamAccountName,
u.OfficeLocation,
u.GivenName,
u.Surname,
u.JobTitle,
u.??["extension_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_PersonID"]
})
.GetAsync();
Please try the below code
try
{
List<Option> requestOptions = new ArrayList<Option>();
requestOptions.Add(new QueryOption("$select", "extension_xxx_FavouriteSeason,DisplayName,Mail,UserPrincipalName"));
var user = await graphClient.Users["xxxx"].Request(requestOptions)
.GetAsync();
Console.WriteLine(JsonConvert.SerializeObject(user));
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With