Class AssetTransfer
Class for operations for transferring the assets over to the target site collection
Inherited Members
Namespace: PnP.Framework.Modernization.Transform
Assembly: PnP.Framework.dll
Syntax
public class AssetTransfer : BaseTransform
Constructors
AssetTransfer(ClientContext, ClientContext, IList<ILogObserver>)
Constructor for the asset transfer class
Declaration
public AssetTransfer(ClientContext source, ClientContext target, IList<ILogObserver> logObservers = null)
Parameters
ClientContext
source
Source connection to SharePoint |
ClientContext
target
Target connection to SharePoint |
IList<ILogObserver>
logObservers
|
Methods
ConvertFileToFolderFriendlyName(String)
Converts the file name into a friendly format
Declaration
public string ConvertFileToFolderFriendlyName(string fileName)
Parameters
System.String
fileName
|
Returns
System.String
|
CopyAssetToTargetLocation(String, String, Int32)
Copy the file from the source to the target location
Declaration
public string CopyAssetToTargetLocation(string sourceFileUrl, string targetLocationUrl, int fileChunkSizeInMB = 3)
Parameters
System.String
sourceFileUrl
|
System.String
targetLocationUrl
|
System.Int32
fileChunkSizeInMB
Size of chunks in MB in which the file will be split to be copied |
Returns
System.String
|
Remarks
Based on the documentation: https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/upload-large-files-sample-app-for-sharepoint
EnsureDestination(String)
Ensure the site assets and page sub-folder exists in the target location
Declaration
public string EnsureDestination(string pageFileName)
Parameters
System.String
pageFileName
|
Returns
System.String
|
EnsureSiteAssetsLibrary()
Create a site assets library
Declaration
public List EnsureSiteAssetsLibrary()
Returns
List
|
GetAssetTransferredIfExists(AssetTransferredEntity)
Get asset transfer details if they already exist
Declaration
public AssetTransferredEntity GetAssetTransferredIfExists(AssetTransferredEntity assetTransferredEntity)
Parameters
AssetTransferredEntity
assetTransferredEntity
|
Returns
AssetTransferredEntity
|
StoreAssetTransferred(AssetTransferredEntity)
Stores an asset transfer reference
Declaration
public void StoreAssetTransferred(AssetTransferredEntity assetTransferredEntity)
Parameters
AssetTransferredEntity
assetTransferredEntity
|
TransferAsset(String, String)
Main entry point to perform the series of operations to transfer related assets
Declaration
public string TransferAsset(string sourceAssetRelativeUrl, string pageFileName)
Parameters
System.String
sourceAssetRelativeUrl
|
System.String
pageFileName
|
Returns
System.String
|
Validate()
Perform validation
Declaration
public void Validate()
ValidateAssetInSupportedLocation(String)
Checks if the URL is located in a supported location
Declaration
public bool ValidateAssetInSupportedLocation(string sourceUrl)
Parameters
System.String
sourceUrl
|
Returns
System.Boolean
|