Tchater maintenant avec le support
Tchattez avec un ingénieur du 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

UploadLargeFileAPI Object Reference

Method Reference

The following method is provided by the UploadLargeFileAPI object:

Method Name

Parameters

Description

void PerformUploadLargeFile(string fullFilename, string listUrl)

ListURL - Destination URL of the Document Library where the file will be uploaded. An example is:

http://server/sites/web1/Pages/default.aspx

 

FullFileName - Full UNC path of the file to be uploaded

Uploads a file larger than the Web Application upload limit to a document library and externalizes that large file to the profile endpoint. An aspx file is placed in the document library that points to the large file.

Property Reference

The UploadLargeFileAPI object has properties that can be set to track the upload and log the progress.

Property Name

Data Type

Required

Description

WrapLogger

log

No

Can be used to set up logging of the large file upload.

void SetLoggers(Action<string> Info, Action<string> Error)

Action

TrackProgress

No

Delegate that could be used for tracking the upload progress, the delegate receive two parameters: bytes already uploaded, and total bytes to be uploaded.

 

Action<long, long

Upload Large File API Code Example

The LargeFileUploaderAPI allows a way to upload large files (those greater than the max upload limit for the Web Application) into a SharePoint Document Library, where a StoragePoint profile is configured.

Basic example, without logs and tracking set:

 

        static void Main(string[] args)

        {

            var listUrl = "http://server:6003/Shared%20Documents";

            var fullFilename = @"c:\Uploads\smFile10M.txt";

            LargeFileUploaderAPI uploader = new LargeFileUploaderAPI();

            uploader.PerformUploadLargeFile(fullFilename, listUrl);

        }

 

Example with logs set:

 

        static void Main(string[] args)

        {

            LargeFileUploaderAPI uploader = new LargeFileUploaderAPI();

            uploader.log.SetLoggers(Console.WriteLine, Console.WriteLine);

            var listuri = "http://server:3265/sites/siteCollection/Shared%20Documents/Forms/AllItems. aspx?RootFolder=%2Fsites%2FsiteCollection%2FShared%20Documents%2FFolderTest&FolderCTID=0x012000A5FC1D1D7E870B4A97A9E2704833E271&View=%7B835F52A6%2D5514%2D45AD%2D901B%2D8CC94564B3E5%7D";

            var file = @"C: \documents\windows-8-start-screen. png";

            uploader.PerformUploadLargeFile(file, listuri);

        }

 

Example with logs and tracking usage:

 

        static void Main(string[] args)

        {

            var listUrl = "http://server:6003/Shared%20Documents";

            var fullFilename = @"c:\Uploads\smFile10M.txt";

            LargeFileUploaderAPI uploader = new LargeFileUploaderAPI();

            uploader.log.SetLoggers(Console.WriteLine, Console.WriteLine);

            uploader.TrackProgress = (long bytesSent, long total) =>

            {

                var percentage = total > 0 ? ((float)bytesSent / (float)total) * 100 : 0;

                Console.WriteLine("{0}  --  {1}  :   {2}%", bytesSent, total, percentage);

            };

            uploader.PerformUploadLargeFile(fullFilename, listUrl);

        }

 

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

                }

 

           }

 }  

  }

}

 

Documents connexes

The document was helpful.

Sélectionner une évaluation

I easily found the information I needed.

Sélectionner une évaluation