|
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint.StsAdmin;
namespace HSG.Sharepoint.STSADM.Commands
{
/// <summary>
/// Displays information about all Timer Job Definitions in a site collection.
/// </summary>
public class GetJobInfos : ISPStsadmCommand
{
public string GetHelpMessage(string command)
{
return "\r\n\r\nDisplays Information about the all Timer Jobs in the given site collection\r\n\r\nParemeters:\r\n\t-url <url of site collection>";
}
public int Run(string command, System.Collections.Specialized.StringDictionary keyValues, out string output)
{
output = string.Empty;
#region Check Arguments
if (!keyValues.ContainsKey("url") || keyValues["url"].Length == 0)
{
output = "Please specify a url of a site collection.";
output += GetHelpMessage(command);
return 0;
}
#endregion
string siteCollectionUrl = keyValues["url"];
using (SPSite site = new SPSite(siteCollectionUrl))
{
foreach (SPJobDefinition job in site.WebApplication.JobDefinitions)
{
if (job != null)
{
output += Helper.GetJobInformation(job);
output += "\r\n";
}
}
}
return 1;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.