Back to column formats
Column formattingSharePoint Online

Call phone number with Microsoft Teams

This sample demonstrates displaying a phone number stored in a single line of text column as a link to initiate a Microsoft Teams call.

Call phone number with Microsoft Teams formatting preview
Sample preview · View original image

Copy. Apply. Make it yours.

Get this format

1 definition

Review the requirements below, then paste this JSON into the matching formatting panel. Show me where.

Use your list's internal column names and replace any tenant-specific URLs or flow IDs. Formatting is presentation, not a way to secure data.

Column formatting
Download JSON
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "children": [
    {
      "elmType": "span",
      "style": {
        "display": "inline-block",
        "padding": "0 4px"
      },
      "attributes": {
        "iconName": "=if(@currentField != '','TeamsLogo', '')",
        "class": "ms-font-l"
      }
    },
    {
      "elmType": "a",
      "txtContent": "@currentField",
      "attributes": {
        "href": {
          "operator": "?",
          "operands": [
            {
              "operator": "!=",
              "operands": [
                "@currentField",
                ""
              ]
            },
            "='https://teams.microsoft.com/l/call/0/0?users=4:' + toString(@currentField)",
            ""
          ]
        },
        "target": "_blank",
        "class": "ms-fontColor-themePrimary ms-fontColor-themeDark--hover"
      }
    }
  ]
}

From the contributor

How to use this sample

Summary

This sample demonstrates displaying a phone number stored in a single line of text column as a link to initiate a Microsoft Teams call.

screenshot of the sample

View requirements

  • This format can be applied to a single line of text column

Sample

Solution Author(s)
text-phonenumber-teams-call.json Hagen Deike (@samurai@sueden.social)

Version history

Version Date Comments
1.0 February 16, 2024 Initial release

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.


Additional notes

  • Empty fields do not show a Microsoft Teams icon.
  • No syntax checking for phone numbers. What every you enter in the field will be used to initiate the Microsoft Teams call.
  • This sample uses Microsoft Teams deep link to display a link to initiate the Microsoft Teams call.