0

So I have 2 columns "Owner" and "Deputy Owner", both are User columns and both filled.

Is there some way I can make a new column, where I add a mailto icon and after clicking on it, a new mail opens with recipients from both columns?

2
  • Which version of SharePoint you are using? Are these user columns allow multiple user selection or group selection OR just single user selection? Jul 21 at 7:50
  • I use ShP online, and I can input multiple users and even groups. But in this case, I use 1 person in Owner column and 1 or 2 people in Deputy Owner column.
    – Martin Dub
    Jul 21 at 7:52
1

In SharePoint online modern experience, you can use column formatting to add mailto action in one of the column in your list view.

Try using below sample JSON:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "a",
  "attributes": {
    "href": "='mailto:' + join([$Owner.email], ';') + ';' + join([$DeputyOwner.email], ';')"
  },
  "children": [
    {
      "elmType": "span",
      "style": {
        "display": "inline-block",
        "padding": "0 4px"
      },
      "attributes": {
        "iconName": "Mail"
      }
    },
    {
      "elmType": "span",
      "txtContent": "Send email"
    }
  ]
}

Where Owner & DeputyOwner are internal names of your user columns.

Output:

enter image description here


This is just a general JSON sample for mailto action. You can enhance it as per your requirements by looking at the Microsoft documentation

2
  • Thanks. What if I have that column named "Deputy Owner", not "DeputyOwner"? Is there some syntax change?
    – Martin Dub
    Jul 21 at 8:14
  • You can find out the internal name of your column using this link. Always use the internal name in JSON formatting. Jul 21 at 8:59
1

You can achieve this functionality by following 2 ways.

  1. Create Flow which will trigger on click of button. Pass current item id to flow which will get all item properties. Button can be added to any list view column by JSON column formatting. Refer below link to add Button on each row and trigger flow. https://wonderlaura.com/2018/07/18/button-in-sharepoint-list-to-trigger-microsoft-flow/
  2. Create SPFx command set extension which will add custom action on context menu through that you can get current item properties and trigger mail.
1

You could use below JSON code.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "children": [
    {
      "elmType": "span",
      "style": {
        "padding": "12px"
      },
      "txtContent": "email"
    },
    {
      "elmType": "a",
      "attributes": {
        "iconName": "Mail",
        "class": "sp-field-quickActions",
        "href": {
          "operator": "+",
          "operands": [
            "mailto:",
            "=[$Owner.email] + ';'+[$DeputyOwner.email]"
          ]
        }
      }
    }
  ]
}

Result:

enter image description here enter image description here

========================

Update:

Go to library settings -> Columns section -> Click Deputy Owner -> Check internal name in the browser link. enter image description here

2
  • What if I have a space in the column name? Deputy_x0020_Owner does not work for me and nor DeputyOwner, as you mention in your answer.
    – Martin Dub
    Jul 21 at 8:50
  • Please refer the updated answer to check internal name of Deputy Owner column. Jul 21 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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