How do I get the path of where a file is saved to show as a column in Sharepoint?

JRader 25 Reputation points
2024-08-16T15:23:32.3466667+00:00

If I want to find the location where a file is saved in sharepoint, I have to select the 3 dots to the right of the file name, select Details, and scroll to the very bottom of the side menu to see the path. Is there any way to add a column that will automatically show that path, similar to how you can see when the file was created or modified?

Microsoft 365 and Office | SharePoint | Development

Locked Question. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Emily Du-MSFT 51,996 Reputation points Microsoft External Staff
2024-08-19T07:01:41.7266667+00:00

Here is a workaround, create a single line of text column and use following JSON codes to show file path.

Select the column -> Column settings -> Format the column -> Advanced mode -> Use codes.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "='https://tenant.sharepoint.com'+[$FileRef]"
}

enter image description here


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?

10+ people found this answer helpful.

2 additional answers

Sort by: Oldest
  1. Jek 0 Reputation points
    2025-02-21T16:09:26.3466667+00:00

    User's image

    After you create a new column, you need to go to Column settings, then Format this column, where you can find the Advance option to can paste the JSON

    Was this answer helpful?

    0 comments No comments
  2. Laidlaw, Morgan 0 Reputation points
    2026-11-05T10:02:07.8666667+00:00

    For Website owners, adding a column over the Library settings is possible. Gear Symbol in the top Document folder, Library settings, additional settings, create column, JSON text in the format field, colum name required too. Using [$FileDirRef] instead of [$FileRef] leaves out the name of the file.

    User's image

    Worked for finding the path of files that are opened through the library search even when the standard path metadata does not show the full path! Worked on the documents present at the time of column creation, must update the Metadata on opening.

    User's image

    Was this answer helpful?

    0 comments No comments