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()
using Bluethread.SharePoint.StoragePoint.TimerJobAPI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StoragePointAPI
{
public class TimerJobStatusAPIExample
{
public static void GetAvaliableJobsExamples()
{
List<TimerJobStatusAPI> avaliableJobs = TimerJobStatusAPI.GetAvailableJobs();
foreach (TimerJobStatusAPI avaliableJob in avaliableJobs)
{
Console.WriteLine(string.Format("Job Name: {0}", avaliableJob.Name));
Console.WriteLine(string.Format("Job Type: {1}",avaliableJob.Type));
Console.WriteLine(string.Format("Job Started Time: {0}", avaliableJob.Started));
Console.WriteLine(string.Format("Job Server Name: {0}", avaliableJob.Name));
Console.WriteLine(string.Format("Job Status: {0}", avaliableJob.Status));
Console.WriteLine(string.Format("Job State: {0}", avaliableJob.State));
}
}
public static void GetRunningJobsExamples()
{
List<TimerJobStatusAPI> runningJobs = TimerJobStatusAPI.GetRunningJobs();
foreach (TimerJobStatusAPI runningJob in runningJobs)
{
Console.WriteLine(string.Format("Job Name: {0}", runningJob.Name));
Console.WriteLine(string.Format("Job Type: {1}", runningJob.Type));
Console.WriteLine(string.Format("Job Started Time: {0}", runningJob.Started));
Console.WriteLine(string.Format("Job Server Name: {0}", runningJob.Name));
Console.WriteLine(string.Format("Job Status: {0}", runningJob.Status));
Console.WriteLine(string.Format("Job State: {0}", runningJob.State));
}
}
public static void GetCompleteJobsExample()
{
List<TimerJobStatusAPI> completedJobs = TimerJobStatusAPI.GetCompleteJobs();
foreach (TimerJobStatusAPI completeJob in completedJobs)
{
Console.WriteLine(string.Format("Job Name: {0}", completeJob.Name));
Console.WriteLine(string.Format("Job Type: {1}", completeJob.Type));
Console.WriteLine(string.Format("Job Started Time: {0}", completeJob.Started));
Console.WriteLine(string.Format("Job Server Name: {0}", completeJob.Name));
Console.WriteLine(string.Format("Job Status: {0}", completeJob.Status));
Console.WriteLine(string.Format("Job State: {0}", completeJob.State));
Console.WriteLine(string.Format("Job Duration : {0}", completeJob.ElapsedTime));
Console.WriteLine(string.Format("Las error Job : {0}", completeJob.LastErr));
}
}
public static void GetAbandonedJobsExample()
{
List<TimerJobStatusAPI> abandonedJbos = TimerJobStatusAPI.GetAbandonedJobs();
foreach (TimerJobStatusAPI abandonedJob in abandonedJbos)
{
Console.WriteLine(string.Format("Job Name: {0}", abandonedJob.Name));
Console.WriteLine(string.Format("Job Type: {1}", abandonedJob.Type));
Console.WriteLine(string.Format("Job Started Time: {0}", abandonedJob.Started));
Console.WriteLine(string.Format("Job Server Name: {0}", abandonedJob.Name));
Console.WriteLine(string.Format("Job Status: {0}", abandonedJob.Status));
Console.WriteLine(string.Format("Job Error: {0}", abandonedJob.LastErr));
Console.WriteLine(string.Format("Job Completion: {0}", abandonedJob.Completion));
}
}
public static void GetAbortingJobsExample()
{
List<TimerJobStatusAPI> abortedJobs = TimerJobStatusAPI.GetAbortingJobs();
foreach (TimerJobStatusAPI abortJob in abortedJobs)
{
Console.WriteLine(string.Format("Job Name: {0}", abortJob.Name));
Console.WriteLine(string.Format("Job Type: {1}", abortJob.Type));
Console.WriteLine(string.Format("Job Started Time: {0}", abortJob.Started));
Console.WriteLine(string.Format("Job Server Name: {0}", abortJob.Name));
Console.WriteLine(string.Format("Job Status: {0}", abortJob.Status));
Console.WriteLine(string.Format("Job State: {0}", abortJob.State));
Console.WriteLine(string.Format("Job Error: {0}", abortJob.LastErr));
Console.WriteLine(string.Format("Job Completion: {0}", abortJob.Completion));
Console.WriteLine(string.Format("Job Stopped Date: {0}", abortJob.Stopped));
}
}
public static void GetAbortedJobsExample()
{
List<TimerJobStatusAPI> abortedJobs = TimerJobStatusAPI.GetAbortedJobs();
foreach (TimerJobStatusAPI abortedJob in abortedJobs)
{
Console.WriteLine(string.Format("Job Name: {0}", abortedJob.Name));
Console.WriteLine(string.Format("Job Type: {1}", abortedJob.Type));
Console.WriteLine(string.Format("Job Started Time: {0}", abortedJob.Started));
Console.WriteLine(string.Format("Job Server Name: {0}", abortedJob.Name));
Console.WriteLine(string.Format("Job Status: {0}", abortedJob.Status));
Console.WriteLine(string.Format("Job State: {0}", abortedJob.State));
Console.WriteLine(string.Format("Job Stopped Date: {0}", abortedJob.Stopped));
}
}
public static void GetSuspendingJobsExample()
{
List<TimerJobStatusAPI> supendingJobs = TimerJobStatusAPI.GetSuspendingJobs();
foreach (TimerJobStatusAPI suspendingJob in supendingJobs)
{
Console.WriteLine(string.Format("Job Name: {0}", suspendingJob.Name));
Console.WriteLine(string.Format("Job Type: {1}", suspendingJob.Type));
Console.WriteLine(string.Format("Job Started Time: {0}", suspendingJob.Started));
Console.WriteLine(string.Format("Job Server Name: {0}", suspendingJob.Name));
Console.WriteLine(string.Format("Job Status: {0}", suspendingJob.Status));
Console.WriteLine(string.Format("Job State: {0}", suspendingJob.State));
Console.WriteLine(string.Format("Job Stopped Date: {0}", suspendingJob.Stopped));
Console.WriteLine(string.Format("Job ElapsedTime Date: {0}", suspendingJob.ElapsedTime));
}
}
public static void GetSuspendedJobsExample()
{
List<TimerJobStatusAPI> suspendedJobs = TimerJobStatusAPI.GetSuspendedJobs();
foreach (TimerJobStatusAPI suspendedJob in suspendedJobs)
{
Console.WriteLine(string.Format("Job Name: {0}", suspendedJob.Name));
Console.WriteLine(string.Format("Job Type: {1}", suspendedJob.Type));
Console.WriteLine(string.Format("Job Started Time: {0}", suspendedJob.Started));
Console.WriteLine(string.Format("Job Server Name: {0}", suspendedJob.Name));
Console.WriteLine(string.Format("Job Status: {0}", suspendedJob.Status));
Console.WriteLine(string.Format("Job State: {0}", suspendedJob.State));
}
}
public static void GetResumingJobsExample()
{
List<TimerJobStatusAPI> runningJobs = TimerJobStatusAPI.GetResumingJobs();
foreach (TimerJobStatusAPI runningJob in runningJobs)
{
Console.WriteLine(string.Format("Job Name: {0}", runningJob.Name));
Console.WriteLine(string.Format("Job Type: {1}", runningJob.Type));
Console.WriteLine(string.Format("Job Started Time: {0}", runningJob.Started));
Console.WriteLine(string.Format("Job Server Name: {0}", runningJob.Name));
Console.WriteLine(string.Format("Job Status: {0}", runningJob.Status));
Console.WriteLine(string.Format("Job State: {0}", runningJob.State));
}
}
public static void GetJobsWithExceptionExample()
{
List<TimerJobStatusAPI> jobWithException = TimerJobStatusAPI.GetExceptionJobs();
foreach (TimerJobStatusAPI jobWithError in jobWithException)
{
Console.WriteLine(string.Format("Job Name: {0}", jobWithError.Name));
Console.WriteLine(string.Format("Job Type: {1}", jobWithError.Type));
Console.WriteLine(string.Format("Job Started Time: {0}", jobWithError.Started));
Console.WriteLine(string.Format("Job Server Name: {0}", jobWithError.Name));
Console.WriteLine(string.Format("Job Status: {0}", jobWithError.Status));
Console.WriteLine(string.Format("Job State: {0}", jobWithError.State));
Console.WriteLine(jobWithError.Name);
}
}
}
}
The BlobAPI object supports migrating content from one content store to another. This API is callable only from custom .net code such as a SharePoint workflow or event handler. This API should also only be used in a SharePoint context such as an event handler or workflow. Use outside of a SharePoint context is not supported.
Method Reference
The following methods are provided by the BlobAPI object:
Method Name |
Parameters |
Description |
void MigrateBlob (SPListItem listItem, Guid targetProfileId) |
listItem An SPListItem representing the document to migrate.
targetProfileId Id of the profile to migrate document to |
Migrates the document to the specified profile (represented by a Guid profile id). |
void MigrateBlob(SPListItem listItem, string targetProfileId) |
listItem An SPListItem representing the document to migrate.
targetProfileId Id of the profile to migrate document to |
Migrates the document to the specified profile. This overload of the method takes a string representation of the Guid profile id. String must still be in Guid form. |
© ALL RIGHTS RESERVED. Conditions d’utilisation Confidentialité Cookie Preference Center