In this article we will be seeing how to configure a crawl schedule for enterprise search content source in SharePoint 2010 using C#. In the Search service application, you can schedule a full or incremental crawl of a content source. There are four types of Schedules:
Through UI:
C# code:
// Represents a crawl schedule used to specify the number of days between crawls
DailySchedule daily = new DailySchedule(context); daily.BeginDay = 25; daily.BeginMonth = 1; daily.BeginYear = 2010; daily.StartHour = 2; daily.StartMinute = 30; daily.DaysInterval = 1;
// Represents a crawl schedule used to specify the number of weeks between crawls.
WeeklySchedule weekly = new WeeklySchedule(context); weekly.BeginDay = 25; weekly.BeginMonth = 1; weekly.BeginYear = 2010; weekly.StartHour = 23; weekly.StartMinute = 15; weekly.WeeksInterval = 1;
Content ssaContent = new Content(context); ContentSourceCollection ssaContentSources = ssaContent.ContentSources; // Getting the content source ContentSource cs = ssaContentSources["Local SharePoint Sites"]; // Incremental Crawl Schedule cs.IncrementalCrawlSchedule = daily; // Full Crawl Schedule cs.FullCrawlSchedule = weekly; cs.Update();
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: