I am working on a new web part to display a list of files in a SharePoint document library called Medicine files. I want users to be able to filter the files based on different columns, including file names. I am using PnPjs to search for files by name, and it works perfectly for other columns, but not for the file name. Here's my current code:
await sp.web.lists.getByTitle("Medicine files").items.filter("FileLeafRef eq 'test.pdf'").expand("File").orderBy("Created", asc)();
When I use the Name column, I get the following error:
Column 'Name' does not exist. It may have been deleted by another user.
And when I use the FileLeafRef property, I get this error:
The attempted operation is prohibited because it exceeds the list view threshold.
I have tried different column names, such as Name, DisplayName, FileLeafRef, LinkFilenameNoMenu, LinkFilename, and BaseName without success. I have also checked the column name in the column settings, and it is defined as Name.
Any suggestions to help me resolve this issue would be greatly appreciated!