On a SharePoint 2013 on premise installation, we have configured an incremental crawl, that runs every 15 minutes.
Now we need a possibility to start this crawl manually, too. Is there a WebService we can call to start the crawl manually? Maybe even a possibility to start the crawl on a smaller scope, like only a list or website?Answer1:
You may just love <a href="http://blogs.msdn.com/b/powershell/archive/2014/09/29/simple-rest-api-for-executing-powershell-scripts.aspx" rel="nofollow">Simple HTTP api for Executing PowerShell Scripts</a><blockquote>
In cases where you want to simply invoke a PowerShell script remotely, a REST api is a good choice since all modern programming languages make it simple to perform a HTTP GET operation.</blockquote>
and <a href="https://gallery.technet.microsoft.com/scriptcenter/Simple-REST-api-for-b04489f1" rel="nofollow">Simple HTTP api for executing PowerShell scripts</a> (with source code) which is an out of the box solution of what the above is trying to accomplish. Here are the <a href="https://technet.microsoft.com/en-us/library/ee906563.aspx" rel="nofollow">Windows PowerShell cmdlets to administer and configure search in SharePoint 2013</a> for more details.<hr />
Please also look at <a href="http://blogs.msdn.com/b/opal/archive/2010/03/07/sharepoint-2010-with-windows-powershell-remoting-step-by-step.aspx" rel="nofollow">SharePoint Windows PowerShell Remoting</a> if you are interested on more nitty-gritty remote SharePoint control.Answer2:
Try to use <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/28/how-to-use-sharepoint-2010-windows-powershell-cmdlets-to-manage-search-crawls.aspx" rel="nofollow">powershell</a> interface for this purpose.
It is pretty simple when you think about it.
We can use the
Get-SPEnterpriseSearchCrawlContentSource command to get a
After we have a reference to this object, we can start, stop, and pause crawls to our heart’s content.
This class has a few methods that you might be interested in:
What each method does should go without explanation.
If it is necessary, you can create a wrapper for powershell call. Your <a href="http://jeffmurr.com/blog/?p=142" rel="nofollow">web service</a> will call powershell for this purpose.