Linking to a folder referenced in a lookup column

Copper Contributor

I have a SharePoint Online list that has a Lookup column. In this column, each row contains a reference to a folder in a document library.

 

The aim is to provide users with a one-click method of opening the associated folder.

 

Using custom JSON formatting, I have managed to get it to display an icon which links to the folder - sort of:

 

 

{
      "elmType": "a",
      "txtContent": "",
      "attributes": {
        "target": "_blank",
        "iconName": "FabricFolderLink",
        "class": "sp-field-quickAction ms-fontColor-blue",
        "href": "='https://***SITEURL***/***DOCUMENTLIBRARY***/Forms/DispForm.aspx?ID=' + @currentField.lookupValue"
      }
}

 

 The problem is that this opens a page showing the folder's metadata (just Title and Name), not the folder's contents, which is not very useful. Is there any way it can open the folder for browsing?

 

(For some reason, @currentField.lookupValue and @currentField.lookupId both return the same value - the folder's internal ID. I would have thought there must be some way to get a working link from this ID.)

1 Reply

In case someone's still interested, I had the same problem. Fixed it by linking directly to the folder path with something like:

"href": "='https://***SITEURL***/sites/***SITENAME***/***DOCUMENTLIBRARY***/Folder/' + [$Field1] + '/Folder'"

 I used a field value in my link that corresponded with a folder in the library.