Hide file extensions in document name in SharePoint online

Matthew Wolcott 51 Reputation points
2022-07-13T18:23:00.237+00:00

I am trying to hide the file extensions of our documents in the Name field in our document library. I've read this post that says you can use JSON, but it will make it so you can no longer click on the name to open it. That wouldn't work for us. Is there any way to do this? It seems like it should be a simple thing. Thank you.

https://social.technet.microsoft.com/Forums/en-US/75cca0ce-a4e2-4428-89d2-dcd998aa9f4f/hiding-file-extension-in-sharepoint-online-document-library?forum=onlineservicessharepoint

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,154 questions
0 comments No comments
{count} votes

Accepted answer
  1. Dillon Silzer 52,736 Reputation points
    2022-07-13T19:09:56.103+00:00

    Hey @Matthew Wolcott

    Please follow the steps to hide the .extensions:

    1: Open your Document Library

    **2: Click the dropdown on the Name Column > Column Settings > Format this Column **

    220489-image.png

    3: Under Format Columns > Choose Column > Name > Click Advanced Mode

    4: Add the JSON Structure below to the textarea cited from https://social.technet.microsoft.com/Forums/en-US/75cca0ce-a4e2-4428-89d2-dcd998aa9f4f/hiding-file-extension-in-sharepoint-online-document-library?forum=onlineservicessharepoint > Press Save

    {  
       "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",  
       "elmType": "div",  
       "txtContent": "=if(indexOf('@currentField','.') > 0,substring('@currentField',0,indexOf('@currentField','.')),'@currentField')"  
    }  
    

    220479-image.png

    The file extensions should now be gone (TestJSON.json is now TestJSON below)

    220526-image.png

    ----------------------

    If this helps please mark as correct answer.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful