Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, May 24, 2019 1:45 AM
Hi there, does anybody knows what is the JSON format of filename in for a Document library?
I tried to use [$Name], [$FileName], [$File_x0020_Type], [$File Name] and [$File Type], but the file name is not shown.
The following example code is for the references:
{
"schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"debugMode": false,
"hideSelection": true,
"hideColumnHeader": true,
"rowFormatter": {
"elmType": "div",
"attributes": {
"class": "ms-borderColor-neutralLight"
},
"children": [
{
"elmType": "div",
"style": {
"display": "flex",
"flex-wrap": "wrap",
"align-items": "center",
"box-sizing": "border-box",
"padding": "0 20px"
},
"children": [
{
"elmType": "span",
"style": {
"vertical-align": "bottom",
"margin": "0 9px 0 1px"
},
"attributes": {
"iconName": "FolderList"
}
},
{
"elmType": "span",
"attributes": {
"class": "ms-fontWeight-semibold"
},
"style": {
"margin-right": "18px"
},
"txtContent": "[$Name]"
}
]
}
]
}
}
The Document Library:

After apply the list view:

All replies (3)
Friday, May 24, 2019 7:52 AM | 1 vote
Hi,
We can use "[$FileLeafRef]" to get the name.
{
"schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"debugMode": false,
"hideSelection": true,
"hideColumnHeader": true,
"rowFormatter": {
"elmType": "div",
"attributes": {
"class": "ms-borderColor-neutralLight"
},
"children": [
{
"elmType": "div",
"style": {
"display": "flex",
"flex-wrap": "wrap",
"align-items": "center",
"box-sizing": "border-box",
"padding": "0 20px"
},
"children": [
{
"elmType": "span",
"style": {
"vertical-align": "bottom",
"margin": "0 9px 0 1px"
},
"attributes": {
"iconName": "FolderList"
}
},
{
"elmType": "span",
"attributes": {
"class": "ms-fontWeight-semibold"
},
"style": {
"margin-right": "18px"
},
"txtContent": "[$FileLeafRef]"
}
]
}
]
}
}

Best Regards,
Dennis
Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].
SharePoint Server 2019 has been released, you can click
here to download it.
Click
here to learn new features. Visit the dedicated
forum to share, explore and talk to experts about SharePoint Server 2019.
Tuesday, May 28, 2019 8:49 AM
Hi,
Any update?
If my reply help you, please mark the reply as answer, it will make others who stuck with the similar issue easier to search for valid solutions in this forum.
Best regards,
Dennis
Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].
SharePoint Server 2019 has been released, you can click
here to download it.
Click
here to learn new features. Visit the dedicated
forum to share, explore and talk to experts about SharePoint Server 2019.
Thursday, May 30, 2019 7:39 AM
Hi,
Would you please provide us with an update on the status of your issue?
Best Regards,
Dennis
Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].
SharePoint Server 2019 has been released, you can click
here to download it.
Click
here to learn new features. Visit the dedicated
forum to share, explore and talk to experts about SharePoint Server 2019.