So there are User Custom Attributes in Azure B2C which are created in the Portal and they belong to "b2c-extensions-app-blahblah". When I need to set its value programmatically I use await GraphClient!.Applications[b2CExtensionsApp.Id].ExtensionProperties to get the custom attribute and then I add/update its value with:
await GraphClient!.Users[userId].Extensions[userCustomAttr.Id.ToString()].Request().UpdateAsync(ext);
My app does require to have 2 custom user attribute values, so I set them in code. So far so good.
Now, there are OpenExtensions for directory objects. And I want to keep some data with them. Here's how I create its value with:
OpenTypeExtension ilgExt = new()
{
ExtensionName = ILG_USER_CUSTOM_EXTENSION_NAME_S,
AdditionalData = new Dictionary<string, object>
{
{extPropName, value}
}
};
try
{
await GraphClient!.Users[userId].Extensions.Request().AddAsync(ilgExt);
}
catch (Exception ex)
{
string errMsg = $"Could not create extension value {extPropName} for a User '{userId}'";
_logger.LogError(ex, errMsg);
throw new IlgGraphClientException(errMsg, ex);
}
But this throws and exception:
Maximum number of extensions values supported per application is 2
WTF? Why can't I use more? And why custom attributes are taken into account?
Is there any way to have custom attribute values AND extension property values for a User?
