In Microsoft Graph Service SDK 6, how do I retrieve the User's Custom Attribute?
Kevin Guan
25
Reputation points
As of Microsoft Graph SDK 5, the way I retrieved a User's custom attribute information was the following:
final var attribute = graphClient.users("Some_Azure_ID").buildRequest().select("Some_Custom_Attribute").get();
I have upgraded to Microsoft Graph SDK 6 and the above code no longer works to fetch the User's Custom Attribute.
The closest I see relating to custom attributes is the below code, but all returns null.
// These return null, but expected as I dont expect the Custom Attribute to be there
final var attribute1 = graphClient.users().byUserId("Some_Azure_ID").get().getCustomSecurityAttributes();
final var attribute2 = graphClient.users().byUserId("Some_Azure_ID").get().getOnPremisesExtensionAttributes();
// This returns all the built in values, none of the custom values
// When I replace the * with extension_extensionId_customAttributeName, I get an error message saying value not found
final var data = patientGraphClient.users().byUserId(azureId).get( requestConfiguration -> {
requestConfiguration.queryParameters.select = new String[] {"*"};
});
What is the correct way to fetch a User's Custom attribute in Microsoft Graph SDK 6?
Here is an example attribute, 'ba', that I created to try to retrieve via Graph Service, image below: