1

We have document library with .pdf, .docs, .pptx, .url and .jpg type files and file viewer web parts to preview those files. But customer want to remove file Extensions from the Name column and want to keep the link to document with edit menu option in Name column.

So, how can we remove the file extension (.pdf, .pptx, .doc) from the Name column?

1 Answer 1

1

Refer to this post, we could use column formatting to hide file extension:

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

After hiding the file extensions,the file cannot be clickable to open, you could double click the file to open and edit it.

2
  • Thanks, but this substring removed the folders names also. So, I made some changes in the txtContent: "txtContent": "=if(indexOf('@currentField','.') > 0,substring('@currentField',0,indexOf('@currentField','.')),'@currentField')" Commented Jul 13, 2020 at 5:28
  • Thank you for sharing. Commented Jul 17, 2020 at 9:56

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.