Forum Discussion
KevBel
Jul 18, 2023Copper Contributor
Displaying DocLib File URL Path in Column
Good day, Using SharePoint Online (modern) and set up a new document library called DOCLIB1. There are two folders in the library called FOLDER1 and FOLDER2. FILE1.TXT and FILE2.TXT are located wi...
- Jul 18, 2023
Hi KevBel,
you could apply the following json formatting to your "Path" column{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "=[$FileRef]" }
You will get a view like thisIf you don't want the path to your document library to be displayed ("/sites/MyAppPage/CopyLib/" in my example), then use this json
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "=replace([$FileRef],'/sites/MyAppPage/CopyLib/','')" }
This will look like this
Best Regards,
Sven
SvenSieverding
Jul 18, 2023Bronze Contributor
Hi KevBel,
you could apply the following json formatting to your "Path" column
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=[$FileRef]"
}
You will get a view like this
If you don't want the path to your document library to be displayed ("/sites/MyAppPage/CopyLib/" in my example), then use this json
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=replace([$FileRef],'/sites/MyAppPage/CopyLib/','')"
}
This will look like this
Best Regards,
Sven
lpeve01
Jul 17, 2024Copper Contributor
Hello Sven! Thanks so much. it works! I went through the docs but I could not find much about what attributes are available with the `@<attribute_name>`. Can you share some links?