SharePoint Online Modern Search Results using PowerShell

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