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

Validator API

The ValidatorAPI object can be used to verify the identities of endpoints and profiles is correct, before executing commands using that information.

 

Method Name

Parameters

Description

EndpointIdentityValidator (string NameOrID)

NameORID - The endpoint name or ID to be validated.

Verifies that the name or ID is valid.

ProfileIdentityValidator (string profileNameOrID

NameORID - The profile name or ID to be validated.

Verifies that the name or ID is valid.

 

 

 

Validator API Examples

Example:

 

using Bluethread.SharePoint.StoragePoint;

using Bluethread.SharePoint.StoragePoint.ValidatorAPI;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

 

namespace StoragePointAPI

{

    public class ValidatorExamples

    {

        public static void ValidatorProfile()

        {

            EndpointIdentityValidator endPointValidator = new EndpointIdentityValidator("EP1");

            Guid endPointId;

            endPointValidator.IsValidString(out endPointId); // return true and the Guid of Endpoint if it exists inside STP database in other case it throws a exception

        }

 

        public static void ValidatorEndpoint()

        {

            ProfileIdentityValidator profileValidator = new ProfileIdentityValidator("SharePoint-15548");

            Guid profileId;

            profileValidator.IsValidString(out profileId); // return true and the Guid of Profile if it exists inside STP database in other case it throws a exception

            

        }

 public static void ValidatorEndpointNameExample()

        {

            EndpointIdentityValidator endPointValidator = new EndpointIdentityValidator("EP1");

            Guid endpointId;

            if (endPointValidator.IsValidString(out endpointId))// return true and the Guid of Endpoint if it exists inside STP database in other case it throws a exception

            {

                EndpointAPI EP1 = new EndpointAPI(endpointId);

                Console.WriteLine(string.Format("Endpoint AdapterName : {0} Connection String :{1} Endpoint Status: {2} , ", EP1.AdapterName.ToString(), EP1.Connection, EP1.Status));

            }

        }

 

        public static void ValidatorProfileNameExample()

        {

            ProfileIdentityValidator profileValidator = new ProfileIdentityValidator("SharePoint-15548");

            Guid profileId;

            if (profileValidator.IsValidString(out profileId))// return true and the Guid of Profile if it exists inside STP database in other case it throws a exception

            {

                ProfileAPI webbApp_15548 = new ProfileAPI(profileId);

                Console.WriteLine(string.Format("Profile Type: {0}   Retain Unused BLOBs: {1}", webbApp_15548.Type.ToString(), webbApp_15548.BlobRetentionDays));

            }

        }

 

 

        public static void ValidatorEndpointGuidExample()

        {

            EndpointIdentityValidator endPointValidator = new EndpointIdentityValidator("51F544CA-A32A-4DC4-ADE5-D8BA60DC5638");

            Guid endpointId;

            if (endPointValidator.IsValidString(out endpointId))// return true and the Guid of Endpoint if it exists inside STP database in other case it throws a exception

            {

                EndpointAPI endpointInstance = new EndpointAPI(endpointId);

                Console.WriteLine(string.Format("Endpoint Name: {0} has Compression: {1}, has Encryption: {2} ", endpointInstance.Name, endpointInstance.UseCompression, endpointInstance.UseEncryption));

            }

 

        }

 

        public static void ValidatorProfileGuidExample()

        {

            ProfileIdentityValidator profileValidator = new ProfileIdentityValidator("4CF245C8-0C4B-4344-A4AB-0578C64C6503");

            Guid profileId;

            if (profileValidator.IsValidString(out profileId)) // return true and the Guid of Profile if it exists inside STP database in other case it throws a exception

            {

                ProfileAPI profileInstance = new ProfileAPI(profileId);

                string backupEndpoint =  profileInstance.BackupEndpoint == null"None" : profileInstance.BackupEndpoint.Name;

                string holdEndpoint = profileInstance.HMOnHoldEndpoint == null"None" : profileInstance.HMOnHoldEndpoint.Name;

                string recordEndpoint = profileInstance.RMDeclaredRecordEndpoint == null ? "None" : profileInstance.RMDeclaredRecordEndpoint.Name;

                Console.WriteLine(string.Format("Profile Name: {0}, Profile Scope: {1}, Profile Type: {2}", profileInstance.Name, profileInstance.ScopeId, profileInstance.Type.ToString()));

                Console.WriteLine(string.Format("Endpoint Backup: {0}, Endpoint Hold: {1} Endpoint Record: {2}", backupEndpoint, holdEndpoint, recordEndpoint));

                

                foreach (ProfileEndpointAPI profileEndpoint in profileInstance.ProfileEndpoints)

                {

                    Console.WriteLine(string.Format("Endpoint Name: {0}, Endpoint Status: {1}, Endpoint Adapter: {2} , Endpoint Connection string: {3}",

                        profileEndpoint.Name, profileEndpoint.Status, profileEndpoint.AdapterName, profileEndpoint.Connection));

                }

 

           }

 }  

  }

}

 

StoragePoint APIs in Visual Studio

The following steps will help you to create a project in Visual Studio and manage the StoragePoint APIs.

Prerequisites

·StoragePoint installed.

·Visual Studio 2013 installed on the WFE where SharePoint is hosted.

·See other prerequisites for each API.

Steps

1.Open Visual Studio.

stp api 1

2.File >Create New Project>C# Console.stp api 8

3.Go to Project>Add Reference and select BlueThread.SharePoint.StoragePointAPI assembly.

stp api 2

As a result the following reference should be listed

stp api 3

4.Copy the needed code into the c# class

stp api 4

5.Resolve the libraries.

stp api 5

6.Save the changes and execute the project.

stp api 6

7.As a result you will have the following results

stp api 7

 

Do the same with all the commands that are listed in this guide.

Related Documents