May 06 2024 11:02 AM - edited May 06 2024 11:07 AM
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?
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]"
May 07 2024 01:13 AM
SolutionHere 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.
May 07 2024 01:13 AM
SolutionHere 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.