0

Using CSOM Search API is there a way to filter for only files? Something similar to the following ListItem filter would be ideal:

ListItem.FileSystemObjectType.Equals(FileSystemObjectType.File)

Ex use case:

if (item.FileSystemObjectType.Equals(FileSystemObjectType.File))
{
    // do stuff
}

The only thing similar I have found in documentation would be using the filetype Keyword Query Language (KQL) filter:

filetype:docx

I'd like to avoid using that, however, as setting all the possible valid file types feels like a sloppy solution IMO. Thanks for any feedback!

seanrco
  • 935
  • 5
  • 16
  • 32

1 Answers1

1

You should use the below filter to limit results for documents only:

IsDocument:1
Michael Han
  • 3,475
  • 1
  • 6
  • 8