Chat now with support
Chat with Support

Metalogix StoragePoint 5.8 - 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

Archive API

The ArchiveAPI object allows the creation of StoragePoint archiving rules to existing StoragePoint profiles. This object is usable only from Microsoft .net code.

Archive API Object Reference

Property Reference

The ArchiveAPI object has many properties that can be set to enable various archiving options. These options correspond to fields presented in the Archiving section of the Profile page in StoragePoint’s management console.

AgeRuleFormatAPI crates a rule for archiving content based on elapsed time since the content was created or modified.

Property Name

Data Type

Required

Description

DateProperty

string

yes

Valid values are Created or Modified. Specifies the date field to be used to measure elapsed time.

Duration

int

yes

Duration of time that has elapsed.

Interval

string

yes

Units of timer duration. Valid entries are Day, Days, Month, Months, Year, Years.

MetadataRuleFormatAPI can be used to archive content based on a field that has met archiving conditions.

Property Name

Data Type

Required

Description

Property

string

yes

The metadata column name used to evaluate the content.

Operator

string

yes

The analysis used to evaluate the property.

This will vary depending on the property used, but usually it will be =, <, >, etc.

Value

string

yes

Used to compare against the property.

RetainedVersionRuleFormatAPI can be used to archive content based the version number of the content.

Property Name

Data Type

Required

Description

VersionDefinition

string

yes

A range of versions, or all but current (*).

FromVersion

string

yes

For the Range, specify a starting value.

ToVersion

string

 

If necessary, specify an ending value.

Common fields for all formats.

Property Name

Data Type

Required

Description

DestinationEndpointName

string

yes

The endpoint name or ID for archiving the BLOB when conditions are met.

VersionOptions

string

no

Whether to include major, minor or major-minor versions in the analysis.

 

Archive Rule Code Examples

The ArchiveAPI can be used to add archiving rules to a profile, as seen in the examples below.

 

 

using Bluethread.SharePoint.StoragePoint;

using Bluethread.SharePoint.StoragePoint.ArchiveAPI;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

 

namespace ConsoleApplication1

{

    class Program

    {

        static void Main(string[] args)

        {

 

     ProfileAPI profile = new ProfileAPI("CDB-1111"); //Creates a APIProfile based on existent profile name.

            profile.ArchivingSettings.Enabled = true;         //To enable the Archiving

            

 

 

            MetadataRuleTest(profile);                               //Calls to MetadataRules

            AgeRuleTest(profile);                             //Calls to AgeRuleTest

            VersionRuleTest(profile);                                //Calls to VersionRuleTest

     profile.Save();                                   //Needed to save changes to the profile

        

        }

 

       // Creates a Versioning rule with 2 conditions        

        private static void VersionRuleTest(ProfileAPI profile)

        {

            RetainedVersionRuleAPI retainedVersionRule = new RetainedVersionRuleAPI(profile, "EP2,EP1""cdb:74d30558-d550-4678-8f5c-b75b97855e0f/s:50777858-f8e3-417a-8ca6-973ac0a47209/w:728c538c-8275-43c0-a6c6-5067c6279b7a");

            RetainedVersionRuleFormatAPI retainedInput = new RetainedVersionRuleFormatAPI();

            retainedInput.VersionDefinition = "range";

            retainedInput.DestinationEndpointName = "EP2";

            retainedInput.FromVersion = "1";

            retainedInput.ToVersion = "5";

            retainedInput.Property = "None";

            retainedInput.Operator = "None";

            retainedInput.Value = "None";

            retainedInput.VersionOptions = "minor";

 

 

            RetainedVersionRuleFormatAPI retainedInput2 = new RetainedVersionRuleFormatAPI();

            retainedInput2.VersionDefinition = "*";

            retainedInput2.DestinationEndpointName = "EP1";

            retainedInput2.FromVersion = "2";

            retainedInput2.ToVersion = "5";

            retainedInput2.Property = "Name";

            retainedInput2.Operator = "Contains";

            retainedInput2.Value = "metalogix";

            retainedInput2.VersionOptions = "Major";

 

 

            bool isValidVersion = retainedVersionRule.Validate(retainedInput.GetArchiveRule() + '?' + retainedInput2.GetArchiveRule());            

            retainedVersionRule.Save();

        }

 

       //Creates AgeRuleTest with only one condition 

        private static void AgeRuleTest(ProfileAPI profile)

        {

            AgeRuleAPI ageRule = new AgeRuleAPI(profile, "EP1""cdb:74d30558-d550-4678-8f5c-b75b97855e0f/s:50777858-f8e3-417a-8ca6-973ac0a47209/w:728c538c-8275-43c0-a6c6-5067c6279b7a");

            AgeRuleFormatAPI ageRuleInput = new AgeRuleFormatAPI();

            ageRuleInput.DateProperty = "Created";

            ageRuleInput.Duration = 5;

            ageRuleInput.Interval = "Day";

            ageRuleInput.VersionOptions = "major-minor";

            ageRuleInput.DestinationEndpointName = "EP2";

            ageRuleInput.Property = "Name";

            ageRuleInput.Operator = "Contains";

            ageRuleInput.Value = "metalogix";

 

            bool isValidAge = ageRule.Validate(ageRuleInput.GetArchiveRule());

            ageRule.Save();            

        }

 

//Creates MetadataRuleTest with only one condition

        private static void MetadataRuleTest(ProfileAPI profile)

        {

            MetadataRuleAPI metadata = new MetadataRuleAPI(profile, "EP2""cdb:74d30558-d550-4678-8f5c-b75b97855e0f/s:50777858-f8e3-417a-8ca6-973ac0a47209/w:728c538c-8275-43c0-a6c6-5067c6279b7a");

 

            MetadataRuleFormatAPI metadataInput = new MetadataRuleFormatAPI();

            metadataInput.VersionOptions = "major-minor";

            metadataInput.Property = "Name";

            metadataInput.Operator = "Begins";

            metadataInput.Value = "metalogix";

            metadataInput.DestinationEndpointName = "EP1";

 

            bool isValid = metadata.Validate(metadataInput.GetArchiveRule());

            metadata.Save();            

        }

    }

}

 

Example Two

 

using Bluethread.SharePoint.StoragePoint;

using Bluethread.SharePoint.StoragePoint.ArchiveAPI;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

 

namespace StoragePointAPI

{

    class ArchiveExamples

    {

 

        public static void EnableArchiving()

        { 

            // enable the Archive in the profile

            ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");

            profileInstance.ArchivingSettings.Enabled = true;

            profileInstance.Save();

        }

 

        public static void CreateAgeRulewithMetadata()

        {

            ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");

 

            AgeRuleFormatAPI ageRuleinput = new AgeRuleFormatAPI();

            ageRuleinput.DateProperty = "created"// it can be : created , modified

            ageRuleinput.DestinationEndpointName = "EP1"// endpoint Name

            ageRuleinput.Duration = 15; // duration of the age rule

            ageRuleinput.Interval = "day"// it can be : day,month, year

            // metadata section

            ageRuleinput.Property = "Name"//metadata property name

            ageRuleinput.Operator = "=" ; // operator it depends of the Metadata Name

            ageRuleinput.Value = "Document"//metadata value

            ageRuleinput.VersionOptions = "major-minor"//major and minor version included in the version of age rule

 

            AgeRuleAPI ageRuleAPI = new AgeRuleAPI(profileInstance, "EP1""wa:ec8d5b10-ccc6-4fea-9fad-7e42bd362ab1");

            ageRuleAPI.Validate(ageRuleinput.GetArchiveRule()); // this validate the rule and check it if the any other rule exists for the same scope

            ageRuleAPI.Save(); // it save the rule

        }

 

 

        public static void CreateAgeRuleWithoutMetadata()

        {

            ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");

 

            AgeRuleFormatAPI ageRuleinput = new AgeRuleFormatAPI();

            ageRuleinput.DateProperty = "modified"// it can be : created , modified

            ageRuleinput.DestinationEndpointName = "EP1"// endpoint Name destination

            ageRuleinput.Duration = 2; // duration of the age rule

            ageRuleinput.Interval = "month"// it can be : day,month, year

            // metadata section

            ageRuleinput.Property = "None"//metadata property name

            ageRuleinput.Operator = "None"// operator it depends of the Metadata Name

            ageRuleinput.Value = "None"//metadata value

            ageRuleinput.VersionOptions = "None"//major and minor version included in the version of age rule

 

            AgeRuleAPI metadataRule = new AgeRuleAPI(profileInstance, "EP1""wa:ec8d5b10-ccc6-4fea-9fad-7e42bd362ab1/cdb:b3589d08-70da-4081-a31c-ab52552df86f");

            metadataRule.Validate(ageRuleinput.GetArchiveRule()); // this validate the rule and check it if the any other rule exists for the same scope

            metadataRule.Save(); // it save the rule

        }

 

 

        public static void CreateAgeRuleWithManyConditions()

        {

            ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");

 

            AgeRuleFormatAPI ageRuleinput = new AgeRuleFormatAPI();

            ageRuleinput.DateProperty = "modified"// it can be : created , modified

            ageRuleinput.DestinationEndpointName = "EP1"// endpoint Name destination

            ageRuleinput.Duration = 2; // duration of the age rule

            ageRuleinput.Interval = "month"// it can be : day,month, year

            // metadata section

            ageRuleinput.Property = "None"//metadata property name

            ageRuleinput.Operator = "None"// operator it depends of the Metadata Name

            ageRuleinput.Value = "None"//metadata value

            ageRuleinput.VersionOptions = "None"//major and minor version included in the version of age rule

 

 

            AgeRuleFormatAPI ageRuleinputWithMetadata = new AgeRuleFormatAPI();

            ageRuleinputWithMetadata.DateProperty = "modified"// it can be : created , modified

            ageRuleinputWithMetadata.DestinationEndpointName = "EP3"// endpoint Name destination

            ageRuleinputWithMetadata.Duration = 2; // duration of the age rule

            ageRuleinputWithMetadata.Interval = "month"// it can be : day,month, year

            // metadata section

            ageRuleinputWithMetadata.Property = "Name"//metadata property name

            ageRuleinputWithMetadata.Operator = "begins"// operator it depends of the Metadata Name

            ageRuleinputWithMetadata.Value = "important"//metadata value

            ageRuleinputWithMetadata.VersionOptions = "minor"//major and minor version included in the version of age rule

 

            AgeRuleAPI metadataRule = new AgeRuleAPI(profileInstance, "EP1,EP3""wa:ec8d5b10-ccc6-4fea-9fad-7e42bd362ab1/cdb:b3589d08-70da-4081-a31c-ab52552df86f");

            metadataRule.Validate(ageRuleinput.GetArchiveRule() + "?" + ageRuleinputWithMetadata.GetArchiveRule()); // this validate the rule and check it if the any other rule exists for the same scope

            metadataRule.Save(); // it saves the rule

        }

 

 

        public static void CreateVersionRuleWithMetadata()

        {

            ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");

            RetainedVersionRuleFormatAPI versionRuleFormat = new RetainedVersionRuleFormatAPI();

            versionRuleFormat.DestinationEndpointName = "EP1";

            versionRuleFormat.Property = "Title";

            versionRuleFormat.Operator = "Contains";

            versionRuleFormat.Value = "Salaries";

            versionRuleFormat.VersionDefinition = "*";

            versionRuleFormat.VersionOptions = "minor";

 

            RetainedVersionRuleAPI versionIntance = new RetainedVersionRuleAPI(profileInstance, "EP1""wa:ec8d5b10-ccc6-4fea-9fad-7e42bd362ab1");

            versionIntance.Validate(versionRuleFormat.GetArchiveRule());

            versionIntance.Save();

        }

 

        public static void CreateVersionRuleWihtoutMetadata()

        {

            ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");

            RetainedVersionRuleFormatAPI versionRuleFormat = new RetainedVersionRuleFormatAPI();

            versionRuleFormat.DestinationEndpointName = "EP1";

            versionRuleFormat.Property = "None";

            versionRuleFormat.Operator = "None";

            versionRuleFormat.Value = "None";

            versionRuleFormat.VersionDefinition = "*";

            versionRuleFormat.VersionOptions = "major";

 

            RetainedVersionRuleAPI versionIntance = new RetainedVersionRuleAPI(profileInstance, "EP1""wa:ec8d5b10-ccc6-4fea-9fad-7e42bd362ab1");

            versionIntance.Validate(versionRuleFormat.GetArchiveRule());

            versionIntance.Save();

        }

 

        public static void CreateVersionRulewithManyConditions()

        { 

            ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");

            RetainedVersionRuleFormatAPI versionRuleFormat = new RetainedVersionRuleFormatAPI();

            versionRuleFormat.DestinationEndpointName = "EP1";

            versionRuleFormat.Property = "None";

            versionRuleFormat.Operator = "None";

            versionRuleFormat.Value = "None";

            versionRuleFormat.VersionDefinition = "*";

            versionRuleFormat.VersionOptions = "major";

 

            RetainedVersionRuleFormatAPI secondVersionRule = new RetainedVersionRuleFormatAPI();

            secondVersionRule.DestinationEndpointName = "EP3";

            secondVersionRule.Property = "None";

            secondVersionRule.Operator = "None";

            secondVersionRule.Value = "None";

            secondVersionRule.VersionDefinition = "range";

            secondVersionRule.ToVersion = "5";

            secondVersionRule.FromVersion = "2";

            secondVersionRule.VersionOptions = "major";

 

            RetainedVersionRuleFormatAPI thridVersionRule = new RetainedVersionRuleFormatAPI();

            thridVersionRule.DestinationEndpointName = "EP3";

            thridVersionRule.Property = "Title";

            thridVersionRule.Operator = "begins";

            thridVersionRule.Value = "Sharepoint";

            thridVersionRule.VersionDefinition = "range";

            thridVersionRule.ToVersion = "5";

            thridVersionRule.FromVersion = "2";

            thridVersionRule.VersionOptions = "major";

 

            RetainedVersionRuleAPI versionIntance = new RetainedVersionRuleAPI(profileInstance, "EP1,EP3,EP3""wa:ec8d5b10-ccc6-4fea-9fad-7e42bd362ab1");

            versionIntance.Validate(versionRuleFormat.GetArchiveRule() + "?" + secondVersionRule.GetArchiveRule()+ "?" +thridVersionRule.GetArchiveRule());

            versionIntance.Save();

        }

 

 

        public static void CreateMetadataRule()

        {

            ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");

            MetadataRuleFormatAPI metadataFormatAPI = new MetadataRuleFormatAPI();

            metadataFormatAPI.DestinationEndpointName = "EP1";

            metadataFormatAPI.Operator = "=";

            metadataFormatAPI.Property = "Modified";

            metadataFormatAPI.Value = "12/10/2015";

            metadataFormatAPI.VersionOptions = "minor-major";

            MetadataRuleAPI metadataInstance = new MetadataRuleAPI(profileInstance, "EP1""wa:ec8d5b10-ccc6-4fea-9fad-7e42bd362ab1");

            metadataInstance.Validate(metadataFormatAPI.GetArchiveRule());

            metadataInstance.Save();

        }

 

        public static void CreateMetadataRuleWithManyConditions()

        {

            ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");

            MetadataRuleFormatAPI metadataFirstAPI = new MetadataRuleFormatAPI();

            metadataFirstAPI.DestinationEndpointName = "EP1";

            metadataFirstAPI.Operator = "=";

            metadataFirstAPI.Property = "Select";

            metadataFirstAPI.Value = "James";

            metadataFirstAPI.VersionOptions = "minor-major";

 

            MetadataRuleFormatAPI metadataSecondtAPI = new MetadataRuleFormatAPI();

            metadataSecondtAPI.DestinationEndpointName = "EP3";

            metadataSecondtAPI.Operator = "=";

            metadataSecondtAPI.Property = "Title";

            metadataSecondtAPI.Value = "head first";

            metadataSecondtAPI.VersionOptions = "major";

 

 

            MetadataRuleAPI metadataInstance = new MetadataRuleAPI(profileInstance, "EP1,EP3""wa:ec8d5b10-ccc6-4fea-9fad-7e42bd362ab1/cdb:b3589d08-70da-4081-a31c-ab52552df86f");

            metadataInstance.Validate(metadataFirstAPI.GetArchiveRule() + '?' + metadataSecondtAPI.GetArchiveRule());

            metadataInstance.Save();

        

        }

 

    }

}

Timer Job API

The TimerJobAPI object allows for the configuration of timer jobs and for scheduling and running the jobs. It also has commands for monitoring timer jobs and getting statuses.

Related Documents