The ArchiveAPI object allows the creation of StoragePoint archiving rules to existing StoragePoint profiles. This object is usable only from Microsoft .net code.
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 StoragePoints 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. |
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. |
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
profile.Save(); //Needed to save changes to the profile
//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.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.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
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
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
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
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 CreateMetadataRule()
{
ProfileAPI profileInstance = new ProfileAPI("SharePoint-15548");
MetadataRuleFormatAPI metadataFormatAPI = new MetadataRuleFormatAPI();
metadataFormatAPI.DestinationEndpointName = "EP1";
metadataFormatAPI.Operator = "=";
metadataFormatAPI.Property = "Modified";
metadataFormatAPI.Value = "12/10/2015";
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";
MetadataRuleFormatAPI metadataSecondtAPI = new MetadataRuleFormatAPI();
metadataSecondtAPI.DestinationEndpointName = "EP3";
metadataSecondtAPI.Operator = "=";
metadataSecondtAPI.Property = "Title";
metadataSecondtAPI.Value = "head first";
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();
}
}
}
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.
© ALL RIGHTS RESERVED. 利用規約 プライバシー Cookie Preference Center