SharePoint Online Modern Search Results using PowerShell

%3CLINGO-SUB%20id%3D%22lingo-sub-2092598%22%20slang%3D%22en-US%22%3ESharePoint%20Online%20Modern%20Search%20Results%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2092598%22%20slang%3D%22en-US%22%3E%3CP%3EMy%20requirement%20is%20to%20export%20the%20modern%20search%20results.%20As%20there%20is%20no%20OOTB%20way%20to%20export%20the%20modern%20search%20results%20on%20the%20site%2C%20I%20am%20trying%20to%20create%20a%20PowerShell%20script%20to%20export%20the%20search%20results.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20used%20Submit-PnPSearchQuery%2C%26nbsp%3B%24KeywordQuery%20and%20Search%20api.%20All%203%20are%20returning%20different%20results%20than%20what%20it%20appears%20on%20the%20SharePoint%20Site.%20Below%20is%20the%20Search%20api%20query.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%24RequestUrl%3D%22%24(%24SiteUrl)%2F_api%2Fsearch%2Fquery%3Fquerytext%3D'test'%26amp%3Bselectproperties%3D'Author%2CPath%2CFileType%2CTitle%2CUrl'%26amp%3Browlimit%3D100%26amp%3Bstartrow%3D0%26amp%3Bhithighlightedproperties%3D'Title'%26amp%3Bprocessbestbets%3Dtrue%26amp%3Bamp%3Benablequeryrules%3Dfalse%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20I%20can%20export%20the%20modern%20search%20results%20exactly%20what%20it%20appears%20on%20the%20SharePoint%20site%20using%20PowerShell%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

My requirement is to export the modern search results. As there is no OOTB way to export the modern search results on the site, I am trying to create a PowerShell script to export the search results.

 

I used Submit-PnPSearchQuery, $KeywordQuery and Search api. All 3 are returning different results than what it appears on the SharePoint Site. Below is the Search api query.

 

$RequestUrl="$($SiteUrl)/_api/search/query?querytext='test'&selectproperties='Author,Path,FileType,Title,Url'&rowlimit=100&startrow=0&hithighlightedproperties='Title'&processbestbets=true&enablequeryrules=false"

 

Is there a way I can export the modern search results exactly what it appears on the SharePoint site using PowerShell?

 

 

0 Replies