Customizing Sharepoint document links with images

Meg OliverChild 61 Reputation points
2020-08-13T01:35:00.383+00:00

I am using the new 365 Microsoft SharePoint
17238-capture.jpg
I have a team that wold like to hide the link to a document with an image see attached

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,294 questions
0 comments No comments
{count} votes

Accepted answer
  1. MichaelHan-MSFT 18,021 Reputation points
    2020-08-13T08:56:49.707+00:00

    You could use JSON column formatting to hide the link to a document with an image, below is my sample code fo you:

    {  
    	"$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",  
    	"elmType": "a",  
    	"attributes": {  
    		"href": "@currentField",  
    		"target": "_blank"  
    	},  
    	"children": [  
    		{  
    			"elmType": "img",  
    			"style": {  
    			"width": "150px"  
    			},  
    			"attributes": {  
    			"src": "/SiteAssets/test.png"  
    			}  
    		}  
    	]  
    }  
    

    Note :change the src attribute to your iamge url.

    My test result:

    17413-11.png


0 additional answers

Sort by: Most helpful