Chat now with support
Chat with Support

StoragePoint 6.0 - PowerShell and API Reference Guide

PowerShell Guide
StoragePoint PowerShell Overview Getting Started Profile and Endpoint Management Cmdlets Timer Job Scheduling Cmdlets BLOB Information and Migration Cmdlets Miscellaneous SharePoint Utility Cmdlets PowerShell Script Examples StoragePoint API Reference
About Us

Timer Job Status API Object Reference Code Examples

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);

            }

        }

    }

}

 

Blob Migration API

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.

BlobAPI Object Reference

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.

BlobAPI Object Reference Code Examples

The MigrateBlob method requires a profile id to represent the profile of the content store to migrate to. This can be obtained in couple of different ways:

·Create a No Scope profile in StoragePoint. The ID will be displayed by StoragePoint on the Profiles screen. No Scope profiles are designed specifically for use with the MigrateBlob API.

·Use the ProfileAPI class to look up a profile by site collection id or web app id and  then obtain the ID from the ProfileAPI object (i.e. the ProfileId property).

The following is an example of using the BlobAPI object to migrate content from one profile to another.

          BlobAPI blobAPI = new BlobAPI();

           blobAPI.MigrateBlob(properties.ListItem,

new Guid("FBCA353D-2BF9-4d50-8827-D0760420D86D"));

 

 

 

The following is an example of using the BlobAPI object to retrieve large file size in Kb.

// Method to validate GetLargeFileSize it returns LargeFile (kbs) size in case exists, or -1 other case.

 

            var _docUrl = "http://win-710b6vpt0vj:1111/Shared%20Documents/alas%20de%20ensueño.flv.aspx";    //Url to the large file document

            using (Microsoft.SharePoint.SPSite site = new Microsoft.SharePoint.SPSite(_docUrl))

            {

                using (Microsoft.SharePoint.SPWeb web = site.OpenWeb())

                {

                    Microsoft.SharePoint.SPListItem item = web.GetListItem(_docUrl);

                    BlobAPI blob = new BlobAPI();

                    Console.WriteLine(blob.GetLargeFileSize(item));

                }

            }

Related Documents

The document was helpful.

Select Rating

I easily found the information I needed.

Select Rating