Below is a listing of the profile timer jobs set up with variations on schedule and options.
using Bluethread.SharePoint.StoragePoint;
using Microsoft.SharePoint.Administration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StoragePointAPI
{
public class TimerJobExamples
{
public static void BLOBHealthAnalyzerExample()
{
//create one-time scheduled job to run immediately.
Microsoft.SharePoint.SPOneTimeSchedule oneTimeSchedule = new Microsoft.SharePoint.SPOneTimeSchedule(DateTime.Now);
ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");
profileInstance.CreateBLOBRefScanJob(oneTimeSchedule, true, "5", true, "othermail@gmail.com", false);
}
public static void BLOBHealthAnalyzerWithServerExample()
{
//create one-time scheduled job to run immediately.
Microsoft.SharePoint.SPOneTimeSchedule oneTimeSchedule = new Microsoft.SharePoint.SPOneTimeSchedule(DateTime.Now);
ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");
profileInstance.CreateBLOBRefScanJob(oneTimeSchedule, true, "5", true, "othermail@gmail.com", false, SPServer.Local);
// create daily scheduled job definition
Microsoft.SharePoint.SPDailySchedule dailySchedule = new Microsoft.SharePoint.SPDailySchedule();
dailySchedule.BeginHour = 13;
dailySchedule.EndHour = 18;
dailySchedule.BeginMinute = 10;
dailySchedule.EndMinute = 50;
profileInstance.CreateBLOBRefScanJob(dailySchedule, true, "5", true, "othermail@gmail.com", false);
}
public static void UnusedBLOBCleanupExample()
{
//create one-time scheduled job to run immediately.
Microsoft.SharePoint.SPOneTimeSchedule oneTimeSchedule = new Microsoft.SharePoint.SPOneTimeSchedule(DateTime.Now);
ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");
profileInstance.CreateUnusedBlobCleanupJob(oneTimeSchedule, true, "othermail@gmail.com", true, SPServer.Local, false);
// create daily scheduled job definition
Microsoft.SharePoint.SPDailySchedule dailySchedule = new Microsoft.SharePoint.SPDailySchedule();
dailySchedule.BeginHour = 13;
dailySchedule.EndHour = 18;
dailySchedule.BeginMinute = 10;
dailySchedule.EndMinute = 50;
profileInstance.CreateUnusedBlobCleanupJob(dailySchedule, true, "othermail@gmail.com", true, SPServer.Local, false);
}
public static void BLOBExternalizationExample()
{
//create one-time scheduled job to run immediately.
Microsoft.SharePoint.SPOneTimeSchedule oneTimeSchedule = new Microsoft.SharePoint.SPOneTimeSchedule(DateTime.Now);
ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");
profileInstance.CreateBLOBExternalizationJob(oneTimeSchedule, "5", true, "othermail@gmail.com", true);
// create daily scheduled job definition
Microsoft.SharePoint.SPDailySchedule dailySchedule = new Microsoft.SharePoint.SPDailySchedule();
dailySchedule.BeginHour = 13;
dailySchedule.EndHour = 18;
dailySchedule.BeginMinute = 10;
dailySchedule.EndMinute = 50;
profileInstance.CreateBLOBExternalizationJob(oneTimeSchedule, "5", true, "othermail@gmail.com", true, SPServer.Local);
}
public static void BLOBRecallJobExample()
{
//create one-time scheduled job to run immediately.
Microsoft.SharePoint.SPOneTimeSchedule oneTimeSchedule = new Microsoft.SharePoint.SPOneTimeSchedule(DateTime.Now);
ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");
profileInstance.CreateBLOBRecallJob(oneTimeSchedule, "5", true, "othermail@gmail.com", true);
// create daily scheduled job definition
Microsoft.SharePoint.SPDailySchedule dailySchedule = new Microsoft.SharePoint.SPDailySchedule();
dailySchedule.BeginHour = 13;
dailySchedule.EndHour = 18;
dailySchedule.BeginMinute = 10;
dailySchedule.EndMinute = 50;
profileInstance.CreateBLOBRecallJob(oneTimeSchedule, "5", true, "othermail@gmail.com", true, SPServer.Local);
}
public static void BLOBMigrateJobExample()
{
// get the endpoint source and endpoint target'
EndpointAPI source = new EndpointAPI("EP1");
EndpointAPI target = new EndpointAPI("EP3");
//create one-time scheduled job to run immediately.
Microsoft.SharePoint.SPOneTimeSchedule oneTimeSchedule = new Microsoft.SharePoint.SPOneTimeSchedule(DateTime.Now);
ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");
profileInstance.CreateBLOBMigrateJob(oneTimeSchedule, "5", source, target, true, "othermail@gmail.com", true);
// create daily scheduled job definition
Microsoft.SharePoint.SPDailySchedule dailySchedule = new Microsoft.SharePoint.SPDailySchedule();
dailySchedule.BeginHour = 13;
dailySchedule.EndHour = 18;
dailySchedule.BeginMinute = 10;
dailySchedule.EndMinute = 50;
profileInstance.CreateBLOBMigrateJob(oneTimeSchedule, "5", source, target, true, "othermail@gmail.com", true, "s:4dd13983-aac1-4a98-8e83-a0abf61d11e1", "include");
}
public static void ArchivingAgingJob()
{
//create one-time scheduled job to run immediately.
Microsoft.SharePoint.SPOneTimeSchedule oneTimeSchedule = new Microsoft.SharePoint.SPOneTimeSchedule(DateTime.Now);
ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");
profileInstance.CreateAgingJob(oneTimeSchedule, "5", true, "othermail@gmail.com", true);
// create daily scheduled job definition
Microsoft.SharePoint.SPDailySchedule dailySchedule = new Microsoft.SharePoint.SPDailySchedule();
dailySchedule.BeginHour = 13;
dailySchedule.EndHour = 18;
dailySchedule.BeginMinute = 10;
dailySchedule.EndMinute = 50;
profileInstance.CreateAgingJob(dailySchedule, "5", true, "othermail@gmail.com", true, SPServer.Local);
}
public static void ArchivingMetadataJob()
{
//create one-time scheduled job to run immediately.
Microsoft.SharePoint.SPOneTimeSchedule oneTimeSchedule = new Microsoft.SharePoint.SPOneTimeSchedule(DateTime.Now);
ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");
profileInstance.CreateMetadataJob(oneTimeSchedule, "5", true, "othermail@gmail.com", true);
// create daily scheduled job definition
Microsoft.SharePoint.SPDailySchedule dailySchedule = new Microsoft.SharePoint.SPDailySchedule();
dailySchedule.BeginHour = 13;
dailySchedule.EndHour = 18;
dailySchedule.BeginMinute = 10;
dailySchedule.EndMinute = 50;
profileInstance.CreateMetadataJob(dailySchedule, "5", true, "othermail@gmail.com", true, SPServer.Local);
}
public static void ArchivingVersioningJob()
{
//create one-time scheduled job to run immediately.
Microsoft.SharePoint.SPOneTimeSchedule oneTimeSchedule = new Microsoft.SharePoint.SPOneTimeSchedule(DateTime.Now);
ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");
profileInstance.CreateVersionsJob(oneTimeSchedule, "5", true, "othermail@gmail.com", true);
// create daily scheduled job definition
Microsoft.SharePoint.SPDailySchedule dailySchedule = new Microsoft.SharePoint.SPDailySchedule();
dailySchedule.BeginHour = 13;
dailySchedule.EndHour = 18;
dailySchedule.BeginMinute = 10;
dailySchedule.EndMinute = 50;
profileInstance.CreateVersionsJob(dailySchedule, "5", true, "othermail@gmail.com", true, SPServer.Local);
}
public static void BLOBMigrateRecordsJob()
{
//create one-time scheduled job to run immediately.
Microsoft.SharePoint.SPOneTimeSchedule oneTimeSchedule = new Microsoft.SharePoint.SPOneTimeSchedule(DateTime.Now);
ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");
profileInstance.CreateMigrateRecordsJob(oneTimeSchedule, true, "5", true, "othermail@gmail.com", true);
// create daily scheduled job definition
Microsoft.SharePoint.SPDailySchedule dailySchedule = new Microsoft.SharePoint.SPDailySchedule();
dailySchedule.BeginHour = 13;
dailySchedule.EndHour = 18;
dailySchedule.BeginMinute = 10;
dailySchedule.EndMinute = 50;
profileInstance.CreateMigrateRecordsJob(dailySchedule, "5", true, "othermail@gmail.com", true, SPServer.Local);
}
public static void BLOBMigrateHoldJob()
{
//create one-time scheduled job to run immediately.
Microsoft.SharePoint.SPOneTimeSchedule oneTimeSchedule = new Microsoft.SharePoint.SPOneTimeSchedule(DateTime.Now);
ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");
profileInstance.CreateMigrateHoldsJob(oneTimeSchedule, true, "5", true, "othermail@gmail.com", true);
// create daily scheduled job definition
Microsoft.SharePoint.SPDailySchedule dailySchedule = new Microsoft.SharePoint.SPDailySchedule();
dailySchedule.BeginHour = 13;
dailySchedule.EndHour = 18;
dailySchedule.BeginMinute = 10;
dailySchedule.EndMinute = 50;
profileInstance.CreateMigrateHoldsJob(dailySchedule, true, "5", true, "othermail@gmail.com", true, SPServer.Local);
}
public static void BLOBBackupSyncJob()
{
//create one-time scheduled job to run immediately.
Microsoft.SharePoint.SPOneTimeSchedule oneTimeSchedule = new Microsoft.SharePoint.SPOneTimeSchedule(DateTime.Now);
ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");
profileInstance.CreateBackupSyncJob(oneTimeSchedule, "5", true, "othermail@gmail.com", true);
// create daily scheduled job definition
Microsoft.SharePoint.SPDailySchedule dailySchedule = new Microsoft.SharePoint.SPDailySchedule();
dailySchedule.BeginHour = 13;
dailySchedule.EndHour = 18;
dailySchedule.BeginMinute = 10;
dailySchedule.EndMinute = 50;
profileInstance.CreateBackupSyncJob(dailySchedule, "5", true, "othermail@gmail.com", true, SPServer.Local);
}
}
}
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.)
© 2024 Quest Software Inc. ALL RIGHTS RESERVED. Termini di utilizzo Privacy Cookie Preference Center