Frage

I want to search for content in a specific subsite in sharepoint online. How can I set scope of search to subsite in KQL using powershell csom?

I tried the following query:

$queryText="createdby:$OldAuthor contentclass:STS_ListItem_850  OR (IsDocument:1 FileType:doc* FileType:pdf* FileType:xls* FileType:ppt*) -ContentTypeId:0x0120* -path:{$siteUrl} "

But path parameter did not work and I got results from entire tenant. How can I restrict it to specific subsite?

War es hilfreich?

Lösung

Instead of using -path:{$siteUrl} try site:$($siteUrl), e.g.

$siteUrl = "https://contoso.sharepoint.com/subsite"

$QueryText = " ... site:$($siteUrl)"

Andere Tipps

The character '-'(-path:) means Exclusion, I think you should remove it for your query.

Check here for Official document.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit sharepoint.stackexchange
scroll top