Question

On our solution (SP Foundation) we multiple lists with quite some lookup fields. Some of the lookup fields are user fields who link to the user info list, and we don't want that to happen.

enter image description here

Of course, we can limit the access of the (user info) list itself, but it's not a nice solution when the user clicks on the lookup field, and lands on a access denied page.

The question is: Is it possible to remove the link from the lookupfield? If yes, how?

Was it helpful?

Solution

Your best bet would be to remove that field/column from the Public view and all other views where you dont want to see it.

If you still want to see the value, create a calculated column which extracts the value from the lookup column and displays that. use the =TEXT calculated column

Hope this helps.

OTHER TIPS

The previous answer is really not a solution it is just workaround. You best bet is not to remove field or create some calculated field o just use what SharePoint can give to you. First you should create xsl in mapped folder \14\TEMPLATE\LAYOUTS\XSL for example UsersInfoViewStyles.xsl and add content like in image bellow changing field internal name to you lookup field: enter image description here

Second step is to change XslLink to your created xsl file of view defined in schema.xml file like in image bellow: enter image description here

This will take off links from you lookup field in view. I hope this helps someone in the future.

I used jQuery to remove the links by selecting all anchor tags pointing to the look up list (check the href for each of the look up values and they should all start pointing to some list and have an "ID=" at the end). I then unwrapped it from the tags to just return the text. Here is the code line for my list, but you will of course need to change it to the one your look ups are pointing towards:

$(document).ready(function()
{
     $('a[href*="https://mytest.com/sites/MySite/_layouts/listform.aspx?PageType=4&ListId={DERGERG23THE-CH2E-4Y24-9F9C-434E63RT462RER}&ID="]').contents().unwrap();
});
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top