Chat now with support
Chat mit Support

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

Upload Large File API

The Large File Upload API exposes the ability to upload a large file, similar to the Large File Upload interface on the SharePoint document library ribbon. Only one file at a time can be uploaded with this method. Large File Support must be enabled on the SharePoint farm, on StoragePoint General Settings. An active Storage Profile must exist that covers the destination of the uploaded file.

This API must be called on a server in the SharePoint farm and the user running the code must have administrative rights in SharePoint.

 

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.

Verwandte Dokumente

The document was helpful.

Bewertung auswählen

I easily found the information I needed.

Bewertung auswählen