question

NedermanJosefin-6891 avatar image
0 Votes"
NedermanJosefin-6891 asked BenKhnel-3330 commented

Sharepoint List lookup does not link to document as expected, instead it links to page about document

I have a List with a lookup column, looking up documents. I expected the items in the column to link to the document itself, but instead they link to som sort of "about page" for the document in question. Is there a way to achieve what I was expecting? That is: - A list with items that refer to and use the title of documents in a sharepoint directory AND link directly to this document

office-sharepoint-online
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @NedermanJosefin-6891 ,

Would you tell me whether your issue has been resolved or have any update?
I am looking forward to your reply.

Have a nice day!

0 Votes 0 ·

Hello @NedermanJosefin-6891 ,

Can you tell me whether your issue has been resolved or have any update?

I am looking forward to your reply.

0 Votes 0 ·
EchoDu-MSFT avatar image
0 Votes"
EchoDu-MSFT answered EchoDu-MSFT edited

Hello @NedermanJosefin-6891 ,

As SharePoint does not support to hyperlink value as Lookup field. So, it is not possible to use Lookup column to link directly to the file itself.

Thanks,
Echo Du
=================
If an Answer is helpful, please click "Accept Answer" and upvote it.
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.




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Cloudarijit-8685 avatar image
0 Votes"
Cloudarijit-8685 answered BenKhnel-3330 commented

Hi,
As EchoDu mentioned, it is not possible out of the box as by design lookup column links to display form of the item being looked up, in your case the document display form.

However there is a way to get past this and achieve the functionality using Json Column formatting.


  • Set up the document library Title/Any other custom text column data with the document name with extension. example- the value should be something like "ABC Documents.pdf"

  • In the list where you use lookup, look up to this column -

  • Use JSON fomatting on the lookup column,
    HOW TO REFERENCE

  • Verify the functionality

Here is some json code I was trying out in my environment,

 {
   "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
   "elmType": "a",
   "txtContent": "@currentField.lookupValue",
   "attributes": {
     "target": "_blank",
     "href": "='https://abctenant.sharepoint.com/sites/Demo/Shared%20Documents/' + @currentField.lookupValue"
   }
 }

@currentField.lookupValue will get the text value from lookup library.





· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,

thanks for the insctructions with JSON formatting. This helped me a lot and I am now able to click on the name of the file in my Sharepoint List which then opens the document from my library.

My question concerns a step more. I want to lookup multiple files from my library. When I only use one file to lookup it works but when I choose multiple files they appear in just one link and I can not click them one by one.
It looks like this and leads me to a blank Sharepoint Site.

214199-image.png

Is there a way to apply JSON formatting once again to separate the links for each row?


Another problem occurs when I manually add the file which I want to lookup:
I select the row which I want to edit, then I select "open the details pane", then I scroll down to my Lookup JSON column and click it to add my file which I want to lookup. When I do this, it automatically opens a new Tab which leads me to my library. Is it possible that this does not happen and I can add my lookup file without opening a new Tab?

Thank you very much!

0 Votes 0 ·
image.png (6.5 KiB)