13158

Start a crawl manually via SOAP or REST WebService

Question:

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 ContentSource object. 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: StartFullCrawl, StartIncrementalCrawl, StopCrawl, PauseCrawl, and ResumeCrawl. 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.

Recommend

  • swift + OS X sandboxing: treat 'NSVBOpenPanel' as a 'NSOpenPanel' :: because I n
  • How to create CRITICAL events for Windows Event Viewer?
  • Installing Google Web Toolkit Developer Plugin
  • Find duplicate values in one of the two columns in a text file
  • Azure Resource Template Deployment issues
  • powershell: script to start a program with parameters?
  • In powershell, using the export-csv cmdlet, my ints are being encapsulated by quotes any idea why?
  • CUDA Debugging - VS on windows workstation, GPUs on Linux server?
  • In Akka, is ActorContext thread safe?
  • How to use the resource module to measure the running time of a function?
  • crash in __tcf_0
  • python: forcing relative imports to search from script file
  • Python 3.2.2, error(scripts to exe)
  • For loop with if condition on multiple R functions
  • Yii2: Finding file and getting path in a directory tree
  • Authentication in Play! and RestEasy
  • WPF ICommand CanExecute(): RaiseCanExecuteChanged() or automatic handling via DispatchTimer?
  • How solve “Qt: Untested Windows version 10.0 detected!”
  • Code in Job's Script Block after Start-Process Does not Execute
  • jQuery ready not fired after rails link_to is clicked
  • Content-Length header not returned from Pylons response
  • JQuery Internet Explorer and ajaxstop
  • Use of this Javascript
  • Test if a set exists before trying to drop it
  • Bad request using file_get_contents for PUT request in PHP
  • DomPDF {PAGE_NUM} not on first page
  • Javascript simulate pressing enter in input box
  • Different response to non-authenticated users and AJAX calls
  • C# - Serializing and deserializing static member
  • Incrementing object id automatically JS constructor (static method and variable)
  • javascript inside java/jsp code
  • Javascript Callbacks with Object constructor
  • How can I use Kendo UI with Razor?
  • Importing jscolor library in angular 2
  • Do create extension work in single-user mode in postgres?
  • Matrix multiplication with MKL
  • PHP: When would you need the self:: keyword?
  • A cron job substitute?
  • ExecuteAsync RestSharp to allow backgroundWorker CancellationPending c#
  • Append folder name and increment by 1 using batch script