LanguageTag for Microsoft 365 Profile Card has been changed

Administrators can use the Microsoft Graph profileCardProperty resource to add extensionAttribute1 – 15 to a Microsoft 365 Profile Card. There are many descriptions on the web of how to add custom properties to a profile card.

Just some lines of code.

PowerShell
Connect-MgGraph -Scopes PeopleSettings.ReadWrite.All	

$Body = @"
{
  "directoryPropertyName": "CustomAttribute8",
  "annotations": [
      {
          "displayName": "Cost center",
          "localizations": [
              {
                  "languageTag": "de-CH",
                  "displayName": "Kostenstelle"
              },
              {
                  "languageTag": "fr-CH",
                  "displayName": "Centre de coûts"
              },
              {
                  "languageTag": "it-CH",
                  "displayName": "Centro di costo"
              }
          ]
      }
  ]
}
"@


$Url = "https://graph.microsoft.com/v1.0/admin/people/profileCardProperties"
$Result = Invoke-MgGraphRequest -Method POST -Uri $Url -Body $Body -ContentType "application/json"


The sample worked in the past, but now the API returns an error message stating that the language is not supported.

[\”Locale ‘de-CH’ is not supported.\”,\”Locale ‘fr-CH’ is not supported.\”,\”Locale ‘it-CH’ is not supported.\”]

PowerShell

The documentation on how to update the profile card now includes samples with a language code (de, no, ru,…) compared to a regional language code (de-CH, de-DE, fr-CH,…) some months ago.

Updated sample from the documentation
Updated sample from the documentation

The page version history includes a commit from February 2024, which notes that the regional language code has changed to language code. All the samples were modified.

I tried the same example with just the language code.
Remember to add the charset in your request; otherwise, special characters (like that in the French name) may be displayed incorrectly.

PowerShell
Connect-MgGraph -Scopes PeopleSettings.ReadWrite.All	

$Body = @"
{
  "directoryPropertyName": "CustomAttribute8",
  "annotations": [
      {
          "displayName": "Cost center",
          "localizations": [
              {
                  "languageTag": "de",
                  "displayName": "Kostenstelle"
              },
              {
                  "languageTag": "fr",
                  "displayName": "Centre de coûts"
              },
              {
                  "languageTag": "it",
                  "displayName": "Centro di costo"
              }
          ]
      }
  ]
}
"@


$Url = "https://graph.microsoft.com/v1.0/admin/people/profileCardProperties"
$Result = Invoke-MgGraphRequest -Method POST -Uri $Url -Body $Body -ContentType "application/json; charset=utf-8"


The request was successful.

PowerShell

The Microsoft 365 Profile Card includes the Cost Center attribute in different languages during the next 24 hours.
To test the different languages, change the display language of Teams on the web. For me, it’s the fastest way to validate the attribute in different languages.

Screenshot
Share
Avatar photo

Tobias Asböck

Tobias is a Senior System Engineer with around ten years of professional experience with Microsoft 365 products such as SharePoint Online, OneDrive for Business, Teams Collaboration, Entra ID, Information Protection, Universal Print, and Microsoft 365 Licensing. He also has 15+ years of experience planning, administering, and operating SharePoint Server environments. Tobias is a PowerShell Scripter with certifications for Microsoft 365 products. In his spare time, Tobias is busy with updates in the Microsoft 365 world or on the road with his road bike and other sports activities. If you have additional questions, please contact me via LinkedIn or [email protected].

Leave a Reply

Your email address will not be published. Required fields are marked *