SharePoint List JSON Formatting - MS Chat link

Brass Contributor

In SharePoint, when you hover over or click a profile image, it opens the contact details with option to "Start Chat"  -- is there a way to create this link in JSON? Or a way to click a link and open MS Teams directly to chat with the person?
TeamsStartChat.png


I'm currently using the following, which works but it first opens Teams on the current browser tab and user has to select either open on client or continue on the web: 

 

 

{
                    "elmType": "a",
                    "attributes": {
                      "iconName": "Chat",
                      "href": "='https://teams.microsoft.com/l/chat/0/0?users=' + [$ContactPersonEmail]",
                      "title": "='Chat with ' + [$FirstName] + ' in Teams'",
                      "class": "ms-fontColor-neutralPrimary ms-fontColor-themePrimary--hover"
                    },
                    "style": {
                      "text-decoration": "none"
                    }
                  }

 

 

 

I tried the following but neither worked:

 

"href":"='msteams://teams.microsoft.com/l/chat/0/0?users=' + [$ContactPersonEmail]"

 

 

 

"href": "='sip:' + [$ContactPersonEmail]"

 

 

1 Reply

@Tamras1972 

  1. What is the column/data type of "ContactPersonEmail" column? JSON might need to adjusted based on column type.
  2. Are you using correct internal name of your SharePoint list column in JSON?

Here is an JSON example which you can try to replicate: SharePoint JSON - Microsoft Teams chat with Task owner 

 

{
  "elmType": "div",
  "style": {
    "width": "100%",
    "display": "=if([$Title] && [$AssignedTo.email], 'block', 'none')",
    "padding-top": "10px",
    "border-top": "1px solid"
  },
  "attributes": {
    "class": "ms-fontColor-neutralSecondary"
  },
  "children": [
    {
      "elmType": "a",
      "attributes": {
        "target": "_blank",
        "href": "='https://teams.microsoft.com/l/chat/0/0?users=' + [$AssignedTo.email] + '&message=This is related to your Task: ' + [$Title]",
        "class": "ms-fontColor-themePrimary"
      },
      "children": [
        {
          "elmType": "span",
          "txtContent": "Chat with Task Owner"
        },
        {
          "elmType": "span",
          "style": {
            "margin-left": "8px",
            "vertical-align": "middle"
          },
          "attributes": {
            "iconName": "TeamsLogo",
            "class": "ms-fontColor-themePrimary ms-fontSize-xl"
          }
        }
      ]
    }
  ]
}

 

It is based on person or group column (Assigned To) in SharePoint list.


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.