KQL syntax to include multiple libraries and limit file extensions in query

matt howell 3,496 Reputation points
2022-01-21T15:09:15.4+00:00

I've tried every variation of this but as soon as I add the scope of sites, it gives no results:

(Path:"https://xxx.sharepoint.com/sites/xxx-brand-portal/Designer%20Assets" OR "https://xxx.sharepoint.com/sites/xxx-brand-portal/General%20Assets" OR "https://xxx.sharepoint.com/sites/xxx-brand-portal/VDS%20Reference%20Thumbnails") AND (FileExtension:gif OR FileExtension:png OR FileExtension:jpg OR FileExtension:mp4 OR FileExtension:doc OR FileExtension:docx OR FileExtension:xls OR FileExtension:xlsx OR FileExtension:ppt OR FileExtension:pptx OR FileExtension:pdf) AND (IsDocument:"True" OR contentclass:"STS_ListItem") 

Extensions alone work but I need to exclude files outside the 3 libraries.
Wrapping multiple urls in parentheses is working in other applications so not sure why it fails here.

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Allen Xu_MSFT 13,891 Reputation points
    2022-01-24T06:27:23.847+00:00

    Hi @matt howell ,

    As per my test, I cannot reproduce this issue on my end and this query text works on my end. I would suggest new a service request in Microsoft 365 admin center. Check with Microsoft experts if there is something wrong in the backend which is controlled by Microsoft and end users have no access to.
    167663-image.png

    ----------

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.