Customize Profile Cards with Graph API

2 minute read

Customize Profile Cards with Graph API

Overview

Profile cards in Office 365 surface information of a user when we select someone’s name or picture in Outlook or other apps in Office 365 (e.g. MS Teams, SharePoint). It is also referred to as a contact card or people card too.

In this article, we will explore how we can customize the profile card by adding a few additional properties to it using Graph API.

Properties in Profile Card

The profile card by default shows the properties from Azure AD including below:

  • Profile picture
  • Contact information (including email, office location, department, job title, etc.)
  • Organization information (including reports to and works with)
  • Files (shared with you)
  • Emails (emails between you and the user)
  • LinkedIn (matching profiles), subject to if the LinkedIn feature is configured in Office 365. Please see my previous post on LinkedIn feature in Office 365

Extend Profile Card with Graph API

Graph API makes it possible to make additional attributes visible on the card as well as add custom attributes from Azure AD.

To list all profileCardProperties:

GET https://graph.microsoft.com/beta/organization/{organizationId}/settings/profileCardProperties

Below additional attributes can be displayed from Azure AD on the profile card:

Azure AD attribute Graph User entity property
UserPrincipalName userPrincipalName
Fax faxNumber
StreetAddress streetAddress
PostalCode postalCode
StateOrProvince state
Alias mailNickname

To add an additional attribute (e.g. Alias) on the profile card, use below:

POST https://graph.microsoft.com/beta/organization/{tenantid}/settings/profileCardProperties

Content-Type: application/json

{
    "directoryPropertyName": "Alias"
}

Custom attributes on a profile card

We can add any of the Azure AD custom extension attributes to users’ profile cards. Custom properties are not searchable.

Adding custom attributes also supports localization. Custom attribute can be added as follows:

POST https://graph.microsoft.com/beta/organization/{tenantid}/settings/profileCardProperties

Content-Type: application/json

{
    "directoryPropertyName": "customAttribute1",
    "annotations": [
        {
            "displayName": "Cost center",
            "localizations": [
                {
                    "languageTag": "de",
                    "displayName": "Kostenstelle"
                }
            ]
        }
    ]
}

Update Custom Attributes

The custom attributes are the exchange properties. To update an individual user’s custom attributes, follow below steps:

  1. Open Microsoft 365 Admin Center.
  2. Navigate to Users > Active Users.
  3. Select any user.

  4. Under Mail, click Edit Exchange properties.

Once you set the custom attributes, they will appear on the profile card.

Note: It may take up to 24 hours to get the custom attributes reflected on the profile card.

Permissions

User.ReadWrite, User.ReadWrite.All delegated permissions will be needed for adding properties to the profile card for an organization.

Use cases

If you want to surface the information from any third-party services, those can be populated to custom attributes in Azure AD.

References

Leave a comment