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

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.

| improve this answer | |
  • 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')" – Anand Pipaliya Jul 13 at 5:28
  • Thank you for sharing. – Julie_MSFT Jul 17 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.