Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.