using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
namespace GetJobHistory
{
class Program
{
static void Main(string[] args)
{
foreach (SPService service in SPFarm.Local.Services)
{
if (service.DisplayName == "My Sample Service")
{
Console.WriteLine("Service Name : "+ service.DisplayName);
Console.WriteLine("############################################################");
foreach (SPJobHistory entry in service.JobHistoryEntries)
{
Console.WriteLine("Job Definition Title - " + entry.JobDefinitionTitle + " : Status - " + entry.Status + " : Start Time - " + entry.StartTime);
}
Console.ReadLine();
}
}
}
}
}