格式化SharePoint列表列时如何在JSON的超链接中包含空格“”

时间:2019-06-09 13:05:50

标签: json sharepoint

我正在尝试使用JSON格式在电子邮件中包含指向特定SharePoint列表项的链接,但是URL包含空格,我似乎没有在超链接中包含空格。

我尝试使用 “%20” 以及 x0020 ,但这只是作为空格读取。

{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
    "elmType": "div",
    "children": [
        {
            "elmType": "span",
            "style": {
                "padding-right": "8px"
            },
            "txtContent": "@currentField.title"
        },
        {
            "elmType": "a",
            "attributes": {
                "iconName": "Mail",
                "class": "sp-field-quickActions",
                "href": {
                    "operator": "+",
                    "operands": [
                        "mailto:",
                        "@currentField.email",
                        "?subject=Task status&body=Hi ","@currentField.title",", Please see below link to a Shared Services Team Task which requires your attention.\r\n\r\n---\r\n",
                        "\r\nClick this link for more info. https://MyCompany.sharepoint.com/sites/SharedServicesDepartment/Lists/Task Management Register/DispForm.aspx?ID=",
                        "[$ID]"
                    ]
                }
            }
        }
    ]
}

我想要实现的是

的超链接

https://MyCompany.sharepoint.com/sites/SharedServicesDepartment/Lists/Task Management Register/DispForm.aspx?ID=

但是它将在第一个空格处切断超链接,而将最后一部分保留为纯文本。

https://MyCompany.sharepoint.com/sites/SharedServicesDepartment/Lists/Task    管理注册/DispForm.aspx?ID =

1 个答案:

答案 0 :(得分:0)

我们可以使用下面的JSON格式来实现它。

{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
    "elmType": "div",
    "children": [
        {
            "elmType": "span",
            "style": {
                "padding-right": "8px"
            },
            "txtContent": "@currentField.title"
        },
        {
            "elmType": "a",
            "attributes": {
                "iconName": "Mail",
                "class": "sp-field-quickActions",
                "href": {
                    "operator": "+",
                    "operands": [
                        "mailto:",
                        "@currentField.email",
                        "?subject=Task status&body=Hi ","@currentField.title",", Please see below link to a Shared Services Team Task which requires your attention.\r\n\r\n---\r\n",
                        "\r\nClick this link for more info. <https://MyCompany.sharepoint.com/sites/SharedServicesDepartment/Lists/Task Management Register/DispForm.aspx?ID=",
                        "[$ID]",
                        ">"
                    ]
                }
            }
        }
    ]
}

参考:Add links containing spaces to an e-mail message