Search does not return any result in MOSS 2007

March 31st, 2010

If MOSS 2007 search does not return any item then you need to do a full crawl.

Below are the steps to do craweling manually

a). Central administration -> Application management -> Create or configure this farm’s shared services in “Office SharePoint Server Shared Services” group.

b) Open shared service of your web application

c) Click on “search settings” in search group.

d). Click on “Content sources and crawl schedules” and select context menu of your content source.

e). In context menu you will get option: Start full Crawl

When you start a crawl, there might be a pop up saying ‘Crawling might be paused because a backup or an index move operation is in progress. Are you sure you want to resume this crawl ?’  Select ‘Yes’

Enjoy searching !!!


Timer Jobs in SharePoint

February 9th, 2010

SharePoint Timer Jobs

>>What do you mean by Timer Jobs?

Windows SharePoint Services 3.0 lets you create custom jobs that are executed at set intervals. These jobs, known as timer jobs.

Or

A timer job is a trigger to start to run a specific Windows service for one of the Microsoft SharePoint Products and Technologies. It contains a definition of the service to run and specifies how frequently the service should be started. The Windows SharePoint Services Timer service (SPTimer) runs timer jobs. Many features in SharePoint Products and Technologies rely on timer jobs to run services according to a schedule.

You can check the status of a timer job and edit the timer job definition.

For the general administration of all jobs, the SharePoint Central Administration Web site has a Timer Job Status page and a Timer Job Definitions page. You can find these pages in Central Administration, on the Operations page, in the Global Configuration section.

From the View menu, you can filter the timer jobs at the following levels:

All   Displays all timer jobs for the farm.

Service   Enables you to display all the timer jobs for a particular service. If you select this command, use the Service menu to select the service by which you want to filter the listed jobs.

Web Application   Enables you to display all the timer jobs for a Web application.
>>Major benefits to using the Windows SharePoint Services timer service

1.This capability is useful for scheduled process jobs because you keep everything in Windows SharePoint Services rather than create a console .exe file .
2.The timer service knows the topology of the Office SharePoint Server farm, and that you can load balance the jobs across all the servers in the farm or tie them to specific servers that are running particular services.
3.This facility can be useful when a project requires a scheduled process to be executed.

>>Creating and Installing Custom Timer Jobs in Windows SharePoint Services 3.0

Creating A Custom Timer Job

1.Timer jobs are represented as Microsoft.SharePoint.Administration.SPJobDefinition objects.
2.To create one, create a new class that inherits from SPJobDefinition.
3.This new class minimally needs one constructor to create the job and a method that overrides the Execute method.
4.This is the method that is called when the job is executed by Windows SharePoint Services.

C# CODE..

public SharePointWarmupJob (SPWebApplication webApp)
: base(JOB_NAME, webApp, null, SPJobLockType.ContentDatabase) {
this.Title = JOB_NAME;
}
public override void Execute (Guid targetInstanceId) {
if (this.WebApplication.Sites.Count > 0)
WarmUpSiteCollection(this.WebApplication.Sites[0]);
}
private void WarmUpSiteCollection (SPSite siteCollecion) {
WebRequest request = WebRequest.Create(siteCollecion.Url);
request.Credentials = CredentialCache.DefaultCredentials;
request.Method = “GET”;
WebResponse response = request.GetResponse();
response.Close();
}
Installing Custom Timer Jobs

1.After you create a timer job, the next step is to install it.
2.You can use the Windows SharePoint Services API. Developers can create custom applications, use PowerShell, or create custom STSADM commands to install the custom timer job.
Or
Another technique is to use a Windows SharePoint Services 3.0 Feature to install and uninstall the custom timer job. Use a Feature receiver to install the feature as shown in the following example.

C# CODE..

public override void FeatureActivated (SPFeatureReceiverProperties props) {
SPWebApplication webApp = props.Feature.Parent as SPWebApplication;
if (webApp == null)
throw new SPException(”Error obtaining reference to Web application.”);

// Ensure the job is not already registered.
foreach (SPJobDefinition job in webApp.JobDefinitions)
if (job.Name == JOB_NAME) job.Delete();

// Install job.
SharePointWarmupJob warmupJob = new SharePointWarmupJob(webApplication);

// Schedule the job to run every minute all the time.
SPMinuteSchedule schedule = new SPMinuteSchedule();
schedule.BeginSecond = 0;
schedule.EndSecond = 59;
schedule.Interval = 1;
warmupJob.Schedule = schedule;

// Save changes.
warmupJob.Update();
}