1

I have a simple SharePoint list of email template to send an email to our customers.

I have the basic JSON format that I got from here https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#create-clickable-actions but I am trying to send an email based on the SharePoint field values. For example: if I click the email button on line1 the email will be send to [email protected]; [email protected] and CC [email protected]; [email protected] and the message will be the MessageBody column. everything works fine but I just don't know the syntax code for CC email.

Here is my SP List:

enter image description here

I used Single line text for both EmailTo and CC column.

and here is the Syntax I used:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "children": [
    {
      "elmType": "span",
      "style": {
        "padding-right": "50px"
      },
      "txtContent": "@currentField.title"
    },
    {
      "elmType": "a",
      "attributes": {
        "iconName": "Mail",
        "class": "sp-field-quickActions",
        "href": {
          "operator": "+",
          "operands": [
            "mailto:",
            "[$EmailTo]",
            "?subject=",
            "[$Title]",
            "&body=",
            "Hello,",
            "\r\n",
            "\r\n",
            "[$MessageBody]",
            "\r\n",
            "\r\n",
            "\r\n",
            "\r\n",
            "Thank you,",
            "\r\n",
            "\r\n",
            "\r\n \r\n",
            "\r\n \r\n"
          ]
        }
      }
    }
  ]
}

Email sample that shows using the code syntax above.

enter image description here

1 Answer 1

0

You have to add CC part like [email protected]. Try using this JSON:

{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
    "elmType": "div",
    "children": [
      {
        "elmType": "span",
        "style": {
          "padding-right": "50px"
        },
        "txtContent": "@currentField.title"
      },
      {
        "elmType": "a",
        "attributes": {
          "iconName": "Mail",
          "class": "sp-field-quickActions",
          "href": {
            "operator": "+",
            "operands": [
              "mailto:",
              "[$EmailTo]",
              "?cc=",
              "[$CC]",
              "&subject=",
              "[$Title]",
              "&body=",
              "Hello,",
              "\r\n",
              "\r\n",
              "[$MessageBody]",
              "\r\n",
              "\r\n",
              "\r\n",
              "\r\n",
              "Thank you,",
              "\r\n",
              "\r\n",
              "\r\n \r\n",
              "\r\n \r\n"
            ]
          }
        }
      }
    ]
  }

Where CC in [$CC] is internal name of CC column. You can get the exact internal name of your column by following this article: How to find the Internal name of columns in SharePoint Online?

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.