Skip to content

Instantly share code, notes, and snippets.

@zzeneg
Created July 9, 2014 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zzeneg/5542565ae3e2bf283ec6 to your computer and use it in GitHub Desktop.
Save zzeneg/5542565ae3e2bf283ec6 to your computer and use it in GitHub Desktop.
TimerJobsLastRunTime
using System;
using System.Linq;
using Microsoft.SharePoint;
namespace ConsoleApplication1
{
internal class Program
{
private static void Main()
{
var jobTitles = new[]
{
"PT Portal Photo Updater Job",
"PT Portal Birthdays Updater Job",
"PT Portal NewEmployees Updater Job",
"PT Portal Birthdays Friday Notifications Job",
"PT Portal NewEmployees Notifications Job"
};
using (var site = new SPSite("http://localhost"))
{
var jobDefinitions = site.WebApplication.JobDefinitions;
foreach (var jobTitle in jobTitles)
{
var job = jobDefinitions.FirstOrDefault(a => a.Title.Equals(jobTitle, StringComparison.InvariantCultureIgnoreCase));
if (job != null)
{
Console.WriteLine("{0} - {1}", job.DisplayName, job.LastRunTime);
}
}
}
Console.WriteLine("End.");
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment