The following example is specific to the Content Migrator Job.
using Bluethread.SharePoint.StoragePoint.TimerJobAPI;
using Microsoft.SharePoint.Administration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StoragePointAPI
{
public class ContentMigratorExample
{
public static void SetRunEveryMinutes_Example()
{
int minutes = 50; //Run every 50 minutes
string serverName = Environment.MachineName;
ContentMigratorJobSettings contentMigratorSettings = ContentMigratorJobSettings.GetInstance(serverName);
contentMigratorSettings.SetRecurrenceDuration(minutes);
contentMigratorSettings.CommitChanges();
}
public static void SetNumberOfThreads_Example()
{
int numberOfThreads = 5; // number of Threads to run the job
string serverName = Environment.MachineName;
ContentMigratorJobSettings contentMigratorSettings = ContentMigratorJobSettings.GetInstance(serverName);
contentMigratorSettings.SetRecurrenceDuration(numberOfThreads);
contentMigratorSettings.CommitChanges();
}
public static void SetJobRole_Example()
{
string jobRole = "standAlone";
string serverName = Environment.MachineName;
ContentMigratorJobSettings contentMigratorSettings = ContentMigratorJobSettings.GetInstance(serverName);
contentMigratorSettings.SetJobRole(jobRole);
contentMigratorSettings.CommitChanges();
}
public static void SetEmailDefault_Example()
{
string emailDefault = "True";
string serverName = Environment.MachineName;
ContentMigratorJobSettings contentMigratorSettings = ContentMigratorJobSettings.GetInstance(serverName);
contentMigratorSettings.SetNotificationEmailDefault(emailDefault);
contentMigratorSettings.CommitChanges();
}
public static void SetNotificationEmailOther_Example()
{
string emailother = "otherMail@hotmail.com";
string serverName = Environment.MachineName;
ContentMigratorJobSettings contentMigratorSettings = ContentMigratorJobSettings.GetInstance(serverName);
contentMigratorSettings.SetNotificationEmailOther(emailother);
contentMigratorSettings.CommitChanges();
}
public static void SetManyPropertiesOfCMQ_Example()
{
string emailother = "otherMail@hotmail.com";
string serverName = Environment.MachineName;
ContentMigratorJobSettings contentMigratorSettings = ContentMigratorJobSettings.GetInstance(serverName);
contentMigratorSettings.SetNotificationEmailOther(emailother);
contentMigratorSettings.SetJobRole("standAlone");
contentMigratorSettings.SetThreads(5);
contentMigratorSettings.CommitChanges();
}
public static void RunJob_Example()
{
string serverName = Environment.MachineName;
ContentMigratorJobSettings contentMigratorSettings = ContentMigratorJobSettings.GetInstance(serverName);
contentMigratorSettings.RunJob(SPServer.Local.Name, "standAlone", 5, true, "otherMail@hotmail.com", "yes", string.Empty);
}
public static void SetScheduleTime()
{
string serverName = Environment.MachineName;
string startHour = "15:15";
string endHour = "20:15";
ContentMigratorJobSettings contentMigratorSettings = ContentMigratorJobSettings.GetInstance(serverName);
contentMigratorSettings.SetStartHour(startHour);
contentMigratorSettings.SetEndHour(endHour);
contentMigratorSettings.CommitChanges();
}
}
}
This is an example for the Capacity Monitor Job.
using Bluethread.SharePoint.StoragePoint.TimerJobAPI;
using Microsoft.SharePoint.Administration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StoragePointAPI
{
public class EndpointCapacityMonitorExamples
{
public static void SetRunEveryMinutes_Example()
{
string serverName = Environment.MachineName;
int runEveryMinutes = 45;
EndPointCapacityMonitorJobSettings endPointCapacityMonitorInstance = EndPointCapacityMonitorJobSettings.GetInstance(serverName);
endPointCapacityMonitorInstance.SetRecurrenceDuration(runEveryMinutes);
endPointCapacityMonitorInstance.CommitChanges();
}
public static void SetBringOfflineEndPointsOnline_Example()
{
string serverName = Environment.MachineName;
string bringOfflineEndpoint = "yes";
EndPointCapacityMonitorJobSettings endPointCapacityMonitorInstance = EndPointCapacityMonitorJobSettings.GetInstance(serverName);
endPointCapacityMonitorInstance.SetBringOfflineEndpointsBackOnline(bringOfflineEndpoint);
endPointCapacityMonitorInstance.CommitChanges();
}
public static void SetEmailDefault_Example()
{
string serverName = Environment.MachineName;
string emailDefault = true.ToString();
EndPointCapacityMonitorJobSettings endPointCapacityMonitorInstance = EndPointCapacityMonitorJobSettings.GetInstance(serverName);
endPointCapacityMonitorInstance.SetNotificationEmailDefault(emailDefault);
endPointCapacityMonitorInstance.CommitChanges();
}
public static void setNotificationEmailOther()
{
string serverName = Environment.MachineName;
string emailOther = "otherMail@hotmail.com";
EndPointCapacityMonitorJobSettings endPointCapacityMonitorInstance = EndPointCapacityMonitorJobSettings.GetInstance(serverName);
endPointCapacityMonitorInstance.SetNotificationEmailOther(emailOther);
endPointCapacityMonitorInstance.CommitChanges();
}
public static void SetScheduleTime()
{
string serverName = Environment.MachineName;
string startHour = "15:15";
string endHour = "20:15";
EndPointCapacityMonitorJobSettings endPointCapacityMonitorInstance = EndPointCapacityMonitorJobSettings.GetInstance(serverName);
endPointCapacityMonitorInstance.SetStartHour(startHour);
endPointCapacityMonitorInstance.SetEndHour(endHour);
endPointCapacityMonitorInstance.CommitChanges();
}
public static void RunJob()
{
string serverName = Environment.MachineName;
EndPointCapacityMonitorJobSettings endPointCapacityMonitorInstance = EndPointCapacityMonitorJobSettings.GetInstance(serverName);
endPointCapacityMonitorInstance.RunJob(SPServer.Local.Name, "yes", true, "otherMail@hotmail.com");
}
}
}
The TimerJobStatusAPI retuns lists of timer jobs in their current state (running, completed, etc.)
The following can be used to list jobs in the following statuses.
public static List<TimerJobStatusAPI> GetAvailableJobs()
public static List<TimerJobStatusAPI> GetRunningJobs()
public static List<TimerJobStatusAPI> GetCompleteJobs()
public static List<TimerJobStatusAPI> GetAbandonedJobs()
public static List<TimerJobStatusAPI> GetAbortingJobs()
public static List<TimerJobStatusAPI> GetAbortedJobs()
public static List<TimerJobStatusAPI> GetSuspendingJobs()
public static List<TimerJobStatusAPI> GetSuspendedJobs()
public static List<TimerJobStatusAPI> GetResumingJobs()
public static List<TimerJobStatusAPI> GetExceptionJobs()
© 2024 Quest Software Inc. ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center