Site icon Office 365 for IT Pros

Customizing the Microsoft 365 Profile Card with the Graph Explorer

Advertisements

Making the Microsoft 365 Profile Card Your Own

Updated 12 November 2023

In Office 365 notification MC217813 (published 1 July and updated on 15 July), Microsoft announced that: “You will be able to customize profile cards according to your organization business needs. The profile card is sometimes referred to as a contact card or people card.” (Microsoft 365 roadmap item 61502).

The new functionality sounds promising. The profile or people card displays information about someone in different places in Microsoft 365 applications. For instance, you can select an email sender or recipient in Outlook or Outlook mobile to view the details of that person. If they’re someone in your organization, the profile card shows you information from their Azure Active Directory account. The information is more limited for external people.

Customizing the Profile Card

The announcement points to documentation about how to customize the profile card. Essentially, you update the ProfileCardProperty Graph resource to add new information to the Microsoft 365 profile card. Six standard Azure Active Directory properties can be added along with the fifteen custom attributes available for organizations to use as they wish (like CustomAttribute11, which Microsoft recently considered using to identify the room mailboxes needed for its Workspaces feature). Custom attributes are used for many purposes, including to hold organizational information (like cost centers and division names), mark mailboxes for special processing, and so on.

Nice as it is to be able to customize the profile card, the immediate barrier facing many tenant administrators is not knowing how to interact with the Graph to update the ProfileCardProperty resource. Not everyone has mastered Graph programming, and administrators who know PowerShell might not yet have ventured into interacting with the Graph (some examples of using PowerShell with the Graph are listed below).

Graph Explorer Delivers an Answer

As it turns out, the Graph Explorer makes it easy to apply the necessary changes. This is a browser interface to allow people to interact with the Graph and get to know how Graph transactions work against different endpoints, such as Groups, Outlook, Planner, and SharePoint. You can run commands against test data or, after signing into a tenant account, against live data. Programmers can grab code snippets generated for transactions by the Explorer in C#, Java, JavaScript, and Objective-C and include the code in their programs. All in all, the Graph Explorer is a very useful tool.

Using Graph Explorer to Update the Profile Card

The key points about using the Graph Explorer to update the ProfileCardProperty resource are:

Figure 1 shows the Graph Explorer after running a successful update. You can see the 200 response.

Figure 1: Using the Graph Explorer to update the ProfileCardProperty resource with a POST command

You can make multiple updates to add more properties or add all the properties at one time by including them in the request body. For example, this request body specifies three properties to add to the profile card:

{
  "directoryPropertyName": "StreetAddress",
  "directoryPropertyName": "PostalCode",
  "directoryPropertyName": "userPrincipalName"
}

Microsoft warns that it takes up to 24 hours for the changes to show on user profile cards. It also seems that you need to add updates one by one and wait until an update is active before applying another. To check the current state of the ProfileCardProperty resource, you can run a GET command to see what’s returned by https://graph.microsoft.com/v1.0/admin/people/profileCardProperties.

Figure 2 shows that I have added two of the standard properties (UserPrincipalName and StreetAddress) and CustomAttribute12. Note that the custom attribute is assigned a display name of “Cost Center” to make its use more obvious to end users.

Figure 2: Checking updates applied to the ProfileCardProperty resource with a GET command

The Microsoft Graph PowerShell SDK can retrieve details of custom properties. For example, this output shows that the tenant customized the profile to include three standard attributes for Azure AD accounts (userPrincipalName, StreetAddress, and PostalCode) and added two custom attributes to display the user’s cost center and preferred drink, which are stored in CustomAttribute12 and CustomAttribute9 respectively:

Connect-MgGraph -NoWelcome -Scopes "PeopleSettings.ReadWrite.All","PeopleSettings.Read.All"

Get-MgAdminPeopleProfileCardProperty | Format-List

Annotations           : {}
DirectoryPropertyName : userPrincipalName
Id                    :
AdditionalProperties  : {}

Annotations           : {Cost center}
DirectoryPropertyName : customAttribute12
Id                    :
AdditionalProperties  : {}

Annotations           : {}
DirectoryPropertyName : StreetAddress
Id                    :
AdditionalProperties  : {}

Annotations           : {}
DirectoryPropertyName : Postalcode
Id                    :
AdditionalProperties  : {}

Annotations           : {Drink}
DirectoryPropertyName : CustomAttribute9
Id                    :
AdditionalProperties  : {}

Viewing Custom Profile Cards in Applications

After the Graph processes everything and applications refresh their cache, you’ll see the customizations show up in the profile cards displayed by applications. Figure 3 shows how OWA displays customized contact information in the Microsoft 365 profile card while Figure 4 shows how the card appears in Outlook Mobile.

Figure 3: OWA displays a customized Microsoft 365 profile card
Figure 4: Outlook Mobile displays a customized Office 365 profile card

The customized attributes don’t appear for guest accounts.

If you make a mistake and add the wrong attribute or want to start over, you can remove an attribute from the organization settings by running a DELETE request. For example, to remove CustomAttribute15 from the set shown on the user profile card, run a DELETE request against https://graph.microsoft.com/v1.0/admin/people/profileCardProperties/customAttribute15

Gets Real Work Done

The notion of having to write code to interact with the Graph might well have turned people away from even considering customizing the profile card. The Graph Explorer allows you to do the job without writing a single line of code. It’s a great example of using an available tool to achieve a goal in a way that the authors of the feature probably never considered.

Some PowerShell with Graph Articles

How to report SharePoint Online site usage.

Fetching Azure AD Account Sign-in Information.

Fetching Planner Data for a Single User.

Generating a User Activity Report.

Handling pagination when fetching Graph data.

Exit mobile version