Frage

I'm formatting the view of an entire list using JSON.

Using the following code, the date modified and editor are not visible.

{"elmType": "span","txtContent": "[$Editor]"}

Same problem with [$Modified]

War es hilfreich?

Lösung

Try this JSON for test (it is working for me):

{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
    "hideSelection": true,
    "hideColumnHeader": true,
    "rowFormatter": {
        "elmType": "div",
        "attributes": {
            "class": "sp-row-card"
        },
        "children": [
            {
                "elmType": "div",
                "attributes": {
                    "class": "sp-row-title"
                },
                "txtContent": "[$Modified]"
            },
            {
                "elmType": "div",
                "attributes": {
                    "class": "sp-row-title"
                },
                "txtContent": "[$Editor.email]"
            }
        ]
    }
    
}

Note:

In order to access the Modified By and Modified columns in JSON, it should be included in the list view.

You can include the column in list view from view settings like:

enter image description here

official documentations:

  1. Use view formatting to customize SharePoint
  2. Use column formatting to customize SharePoint - You can find supported functions and guidelines for JSON formatting in this link

The people field object has the following properties (with example values):

{
   "id": "122",
   "title": "Kalya Tucker",
   "email": "kaylat@contoso.com",
   "sip": "kaylat@contoso.com",
   "picture": "https://contoso.sharepoint.com/kaylat_contoso_com_MThumb.jpg?t=63576928822",
   "department":"Human Resources",
   "jobTitle":"HR Manager"
}

Also, to convert the date columns in other formats, you can use toLocaleDateString() or toLocaleString() functions.

Andere Tipps

You could try to use:[$Editor.title] to show the editor name.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit sharepoint.stackexchange
scroll top