0

I had the following query:

https://[tenant].sharepoint.com/_api/search/query?querytext='Path:"https://one365dev1.sharepoint.com/teams/privegroep/Gedeelde%20%20documenten/*%22Isdocument=1"'&Properties=%27EnableDynamicGroups:true'&selectproperties='Title,ServerRedirectedURL,LastModifiedTime,FileType%27&sortlist=%27LastModifiedTime:descending'&rowlimit=10'

but then I realized that it needs to support both /sites/ and /teams/ and thus decided to use an OR query to search in both places for the content. It works now but I am clueless of how to implement the (*%22Isdocument=1) part of the query.

the current query:

https://one365dev1.sharepoint.com/_api/search/query?querytext='Path:"https://[tenant].sharepoint.com/teams/privegroep/Gedeelde%20%20documenten/"+OR++Path:"https://[tenant].sharepoint.com/sites/privegroep/Gedeelde%20%20documenten/"'&Properties='EnableDynamicGroups:true'&selectproperties='Title,ServerRedirectedURL,LastModifiedTime,FileType%27&sortlist=%27LastModifiedTime:descending'

Does anyone have any idea of how to go about adding the filter?

0

Add parentheses. Also, I would not advise using IsDocument=True because it excludes certain file types. I typically use ContentTypeId:0x0101. I would also advise adding trimduplicates=false since it useually trims way too much if set to true, which is the default

https://one365dev1.sharepoint.com/_api/search/query?querytext='( Path:"https://[tenant].sharepoint.com/teams/privegroep/Gedeelde%20%20documenten/"%20OR%020Path:"https://[tenant].sharepoint.com/sites/privegroep/Gedeelde%20%20documenten/")%20AND%20ContentTypeId:0x0101'&Properties='EnableDynamicGroups:true'&selectproperties='Title,ServerRedirectedURL,LastModifiedTime,FileType%27&sortlist=%27LastModifiedTime:descending'&trimduplicates=false

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.