Chat now with support
Chat with Support

StoragePoint 6.3 - 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

BlobReferenceAPI Code Example

The static GetBlobRefsForDoc method of the BlobReferenceAPI class will return all of the external BLOB files associated with a given document URL in SharePoint. Since SharePoint can have multiple publishing versions and regular versions associated with a single document URL, this method returns a list of all of the relevant BLOBs

The following is an example of using the BlobReferenceAPI object to retrieve all of the BLOB file references associated with an URL and iterating through the results :

List<BlobReferenceAPI> blobRefs = BlobReferenceAPI.GetBlobRefsForDoc(“http://site1/web1/lib/file.docx”);

    foreach (BlobReferenceAPI blobRef in blobRefs)

     {

        MessageBox.Show("Blob Found: " + blobRef.DocType.ToString() +

            ", Size=" + blobRef.BlobSize +

            ", Version: " + blobRef.Version +

            ", Publishing Level: " + blobRef.DocLevel.ToString() +

            ", File Path: " + blobRef.FilePath);

     }

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

        }

 

Related Documents

The document was helpful.

Select Rating

I easily found the information I needed.

Select Rating