Created
July 9, 2014 10:39
-
-
Save zzeneg/5542565ae3e2bf283ec6 to your computer and use it in GitHub Desktop.
TimerJobsLastRunTime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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