Get filename and file format from display form

Hello dear support team,

i have a SharePoint online form.
How do I get the filename including file format on a display form?
It does not work with the following code:

fd.field('FileLeafRef').control()._el().text();
fd.field('FileLeafRef').value;
fd.field('FileLeafRef').value(1);
fd.field('FileLeafRef').value[1];

Unfortunately, I did not find anything in your documentation as well as in the community.

Thanks for your help.

Best regards.

Hello @RMIC,

Could you please clarify the 'FileLeafRef' field type.

Hello mnikitina,

'FileLeafRef' is the internal column name of the column 'name' in a library.

How do I get the file name and file format of the name column of a document on a display form?

Best regards.

@RMIC,

Please use the following code to get the field value:

fd.field('FileLeafRef').value.BaseName;

You can also use this code to get the file path:

fd.field('FileLeafRef').value.FileUrl

Hello mnikitina,

thanks, that works great.

Best regards.

1 Like