The MigrateBlob method requires a profile id to represent the profile of the content store to migrate to. This can be obtained in couple of different ways:
·Create a No Scope profile in StoragePoint. The ID will be displayed by StoragePoint on the Profiles screen. No Scope profiles are designed specifically for use with the MigrateBlob API.
·Use the ProfileAPI class to look up a profile by site collection id or web app id and then obtain the ID from the ProfileAPI object (i.e. the ProfileId property).
The following is an example of using the BlobAPI object to migrate content from one profile to another.
BlobAPI blobAPI = new BlobAPI();
blobAPI.MigrateBlob(properties.ListItem,
new Guid("FBCA353D-2BF9-4d50-8827-D0760420D86D"));
The following is an example of using the BlobAPI object to retrieve large file size in Kb.
// Method to validate GetLargeFileSize it returns LargeFile (kbs) size in case exists, or -1 other case.
var _docUrl = "http://win-710b6vpt0vj:1111/Shared%20Documents/alas%20de%20ensueño.flv.aspx"; //Url to the large file document
using (Microsoft.SharePoint.SPSite site = new Microsoft.SharePoint.SPSite(_docUrl))
{
using (Microsoft.SharePoint.SPWeb web = site.OpenWeb())
{
Microsoft.SharePoint.SPListItem item = web.GetListItem(_docUrl);
BlobAPI blob = new BlobAPI();
Console.WriteLine(blob.GetLargeFileSize(item));
}
}
The Blob Reference API exposes the ability to determine the BLOB file corresponding to a given SharePoint document. This API exposes functionality similar to the Details screen in StoragePoint.
The BlobReferenceAPI object represents an external BLOB file on the blob store. There is a method for obtaining all of the blob references for a given SharePoint document (by url). This API must be called on a server in the SharePoint farm and the user running the code must have administrative rights in SharePoint.
Method Reference
The following methods are provided by the BlobReferenceAPI object:
Method Name |
Parameters |
Description |
static List<BlobReferenceAPI> GetBlobRefsForDoc(string DocUrl) |
DocUrl An absolute URL representing a document in SharePoint |
Given an absolute URL representing a document, this method returns a list of BlobReferenceAPI objects representing all of the external BLOB files associated with this document. A list is returned because a given document can have multiple versions and multiple publishing states (published, checked out copy, etc.).
The DocUrl parameter is an absolute URL respresenting a document in SharePoint. An example is:
http://server/sites/web1/Pages/default.aspx |
Property Reference
The BlobReferenceAPI object has many properties that provide information about the exposed BLOB file.
Property Name |
Property Data Type |
Description |
FilePath |
string |
Returns the path to the BLOB file. If the file was externalized using the FileSystem adapter, this will be a complete path (ex. \\filer\filestore\folder\folder\filename). For other adapters, this will be only the relative folder + the filename of the file. |
Folder |
string |
The folder on the file store containing the file. For the FileSystem adapter this will include the absolute path from the connection string of the profile. |
BlobId |
string |
The filename of the BLOB file. |
BlobSize |
Int |
The uncompressed size of the original file. This will differ from the actual file on the file store if compression is enabled on the profile. |
ProfileId |
String |
The ID of the profile the file was externalized under. |
Profile |
ProfileAPI object |
A ProfileAPI object representing the profile the file was externalized under. |
DocUrl |
string |
The absolute URL of the doc that the BLOB file belongs to. |
DocId |
Guid |
The internal SharePoint ID of the doc that the BLOB file belongs to. |
DocType |
RefDocType |
Can be Doc if the BLOB file belongs to a document or Version if the BLOB file belongs to a version of the document. |
DocLevel |
RefDocLevel |
Documents in SharePoint can have multiple publishing states. Values for this property include Published for a published doc, Draft for a draft copy and Checkout for a working version of a checked out document. |
Version |
string |
The version of the doc or version that the BLOB file is attached to. For example, 1.5 would mean that the BLOB file belongs to version 1.5 of the document. |
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);
}
© ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center