Linking to a folder referenced in a lookup column

%3CLINGO-SUB%20id%3D%22lingo-sub-2367720%22%20slang%3D%22en-US%22%3ELinking%20to%20a%20folder%20referenced%20in%20a%20lookup%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2367720%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20SharePoint%20Online%20list%20that%20has%20a%20Lookup%20column.%20In%20this%20column%2C%20each%20row%20contains%20a%20reference%20to%20a%20folder%20in%20a%20document%20library.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20aim%20is%20to%20provide%20users%20with%20a%20one-click%20method%20of%20opening%20the%20associated%20folder.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUsing%20custom%20JSON%20formatting%2C%20I%20have%20managed%20to%20get%20it%20to%20display%20an%20icon%20which%20links%20to%20the%20folder%20-%20sort%20of%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%7B%0A%20%20%20%20%20%20%22elmType%22%3A%20%22a%22%2C%0A%20%20%20%20%20%20%22txtContent%22%3A%20%22%22%2C%0A%20%20%20%20%20%20%22attributes%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22target%22%3A%20%22_blank%22%2C%0A%20%20%20%20%20%20%20%20%22iconName%22%3A%20%22FabricFolderLink%22%2C%0A%20%20%20%20%20%20%20%20%22class%22%3A%20%22sp-field-quickAction%20ms-fontColor-blue%22%2C%0A%20%20%20%20%20%20%20%20%22href%22%3A%20%22%3D'https%3A%2F%2F***SITEURL***%2F***DOCUMENTLIBRARY***%2FForms%2FDispForm.aspx%3FID%3D'%20%2B%20%40currentField.lookupValue%22%0A%20%20%20%20%20%20%7D%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3BThe%20problem%20is%20that%20this%20opens%20a%20page%20showing%20the%20folder's%20metadata%20(just%20Title%20and%20Name)%2C%20not%20the%20folder's%20contents%2C%20which%20is%20not%20very%20useful.%20Is%20there%20any%20way%20it%20can%20open%20the%20folder%20for%20browsing%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(For%20some%20reason%2C%20%40currentField.lookupValue%20and%20%40currentField.lookupId%20both%20return%20the%20same%20value%20-%20the%20folder's%20internal%20ID.%20I%20would%20have%20thought%20there%20must%20be%20some%20way%20to%20get%20a%20working%20link%20from%20this%20ID.)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2367720%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
New 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.)

0 Replies