2

I store videos inside a SharePoint document library:

enter image description here

Now I want to display the videos in a custom tile view using JSON formatting, but the "Description" column available in the list view is not displayed in my JSON formatted tile view:

enter image description here

Why are the "Description" column entries not displayed? How can I achieve this?

Here is my code:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/tile-formatting.schema.json",
  "height": 325,
  "width": 250,
  "debugMode": true,
  "hideSelection": true,
  "hideColumnHeader": true,
  "formatter": {
    "elmType": "div",
    "_COMMENT_": "VERTICAL_PANEL_LEVEL1",
    "attributes": {
      "class": "ms-borderColor-neutralLight"
    },
    "style": {
      "box-sizing": "border-box",
      "width": "100%",
      "border-width": "3px",
      "border-style": "solid",
      "padding": "0 0 0 0px",
      "margin-bottom": "2px",
      "display": "flex",
      "flex-direction": "column"
    },
    "children": [
      {
        "elmType": "div",
        "attributes": {
          "class": "sp-row-title"
        },
        "style": {
          "margin": "5px"
        },
        "txtContent": "=if([$Title] == '', substring([$FileLeafRef], 0, indexOf([$FileLeafRef],'.')) , [$Title])"
      },
      {
        "elmType": "div",
        "attributes": {
          "class": "ms-fontSize-m"
        },
        "style": {
          "margin": "5px"
        },
        "txtContent": "= 'Description: ' + [$Description]"
      },
      {
        "elmType": "div",
        "attributes": {
          "class": "ms-fontSize-m"
        },
        "style": {
          "margin": "5px"
        },
        "txtContent": "= 'About: ' + [$About]"
      }
    ]
  }
}

Observations:

In the list view the video description can be displayed as column, but it cannot be edited there (it does not show in the details panel). I can only edit the description directly in the video player:

enter image description here

What I tried:

I tried a workaround creating an additional column showing the content of the "description" column. I tried the formula "=[$Description]", but I must have done something wrong. I always says: "A formula has a spelling mistake or refers to a column that does not exist."

UPDATE: Partly solved. Thanks to GaneshSanap's comment i was able to display the column after finding the internal column name

_ExtendedDescription

Question remaining: how to get rid of the <div> and &quot; stuff?

enter image description here

6
  • 1
    You have to use the internal name of Description column. Get internal name by following this: ganeshsanapblogs.wordpress.com/2023/04/17/…. Also, you have to show/include the description column in list view in order to use it in JSON. Jun 2, 2023 at 10:49
  • @GaneshSanap thanks a lot! I was able to find the internal name "using Classic experience List settings page" as described on your webpage. Now the content of the "Descprition" column is displayed, but it is not correctly serialized (if this is the right expression here?). It is displayed like "<div>...&quot;...</div>". Do you know how to get rid of those? (I will update my question and add a picture to make it more clear)
    – Tom667
    Jun 2, 2023 at 11:37
  • If the column is of type rich text or enhanced rich text, you will see such HTML. In that case, you have to use the Plain multiple lines of text column. Jun 2, 2023 at 11:59
  • @GaneshSanap thanks again, but according to link enabling/disabling text formatting is only available in lists, but I have a Libary. So this does not work here. Another suggestion? :-)
    – Tom667
    Jun 2, 2023 at 12:08
  • 1
    The only idea I currently have: Use stacked "ReplaceAll" string methods in the json formatting to get rid of unwanted substrings. Very ugly solution and error-prone, but the best I have so far...
    – Tom667
    Jun 2, 2023 at 12:18

1 Answer 1

1

While using a SharePoint list/library column in JSON formatting, make sure below things:

  1. You have to use the internal name of your SharePoint list/library column. Get internal name by following this: How to find the Internal name of columns in SharePoint Online?
  2. You have to show/include the column in list/library view in order to use it in JSON formatting.

Also, use Plain multiple lines of text column to avoid HTML tags being shown in JSON formatted SharePoint list/library view instead of rich / enhanced rich text multiple lines of text column.

1
  • good solution, but as mentioned above switching to plain text does not work for Libraries (only for Lists)
    – Tom667
    Jun 2, 2023 at 12:11

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.