Forum Discussion

Chauc3r's avatar
Chauc3r
Copper Contributor
Oct 13, 2020
Solved

Person-Hover-card Issue

I've got two lists (on different sites).

 

One works beautifully using the Person-Hover-Card JSON:

One doesn't work at all:

 

Any ideas what's fouling it up? I'm assuming some sort of global setting somewhere?

Thanks!

  • Chauc3r , Use below code to apply JSON to Created By field:

     

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "div",
      "children": [
        {
          "elmType": "img",
          "style": {
            "width": "32px",
            "height": "32px",
            "overflow": "hidden",
            "border-radius": "50%",
            "margin": "2px"
          },
          "attributes": {
            "src": "='/_layouts/15/userphoto.aspx?size=S&accountname=' + [$Author.email]",
            "title": "[$Author.title]"
          }
        },
        {
          "elmType": "span",
          "style": {
            "vertical-align": "middle",
            "margin-left": "2px"
          },
          "txtContent": "[$Author.title]"
        }
      ],
      "defaultHoverField": "[$Author]"
    }

     


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

     

  • Chauc3r , Can you please add the JSON you are using to your question?

    It will be easier for us to see if there is any error in your JSON code and answer your question.


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

     

    • Chauc3r's avatar
      Chauc3r
      Copper Contributor

      ganeshsanap 
      I hope not - copied directly from github!

      {
        "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
        "elmType": "div",
        "children": [
          {
            "elmType": "img",
            "style": {
              "width": "32px",
              "height": "32px",
              "overflow": "hidden",
              "border-radius": "50%",
              "margin": "2px"
            },
            "attributes": {
              "src": "='/_layouts/15/userphoto.aspx?size=S&accountname=' + [$Editor.email]",
              "title": "[$Editor.title]"
            }
          },
          {
            "elmType": "span",
            "style": {
              "vertical-align": "middle",
              "margin-left": "2px"
            },
            "txtContent": "[$Editor.title]"
          }
        ],
        "defaultHoverField": "[$Editor]"
      }

       

      Thanks

      • Chauc3r , Use below code to apply JSON to Created By field:

         

        {
          "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
          "elmType": "div",
          "children": [
            {
              "elmType": "img",
              "style": {
                "width": "32px",
                "height": "32px",
                "overflow": "hidden",
                "border-radius": "50%",
                "margin": "2px"
              },
              "attributes": {
                "src": "='/_layouts/15/userphoto.aspx?size=S&accountname=' + [$Author.email]",
                "title": "[$Author.title]"
              }
            },
            {
              "elmType": "span",
              "style": {
                "vertical-align": "middle",
                "margin-left": "2px"
              },
              "txtContent": "[$Author.title]"
            }
          ],
          "defaultHoverField": "[$Author]"
        }

         


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

         

Resources