using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using Microsoft.SharePoint.Administration;
public ExecuteSharePointJob(string sJobName)
{
SPSite site = new SPSite("http://localhost");
//foreach (SPService srv in SPFarm.Local.Services)
//{
//foreach (SPJobDefinition job in srv.JobDefinitions)
foreach (SPJobDefinition job in site.WebApplication.JobDefinitions)
{
string jobTitle = job.Title;
if (jobTitle == JobName)
{
Trace.WriteLine("***************** Start of execution for job");
job.Execute(new Guid("PassTheContentDBGUID"));
Trace.WriteLine("***************** End of execution for job");
}
}
//}
}
Monday, September 22, 2008
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment