Site.CreateMigrationJob method

SharePoint Online

This method creates a new migration import job and queues it up for later processing by a separate timer job. The job will consume a well formed (pre-defined format) import package that is located in the Azure Blob Storage Container(s) specified in this method. The Service Level Agreement (SLA) for migration job processing is controlled through pre-configured queue and work load throttling settings, and there is no guaranteed SLA or return time for a submitted job.

Namespace:  Microsoft.SharePoint.Client
Assembly:  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

public ClientResult<Guid> CreateMigrationJob(
	Guid gWebId,
	string azureContainerSourceUri,
	string azureContainerManifestUri,
	string azureQueueReportUri
)

Parameters

gWebId
Type: System.Guid

The unique identifier of the destination web for the package import. Additional information and identifiers for the import are specified within the import package itself. This identifier can be found programmatically by querying the target web using the SharePoint Client API.

azureContainerSourceUri
Type: System.String

A valid URL, including SAS token for accessing the Azure Blob Storage Container which contains the binary files of type block. The SAS token must be created with only Read and List permissions or the migration job will fail. The SAS token should have (at least) a lifetime that starts no later than when the job was submitted, until a reasonable time has passed for successful import to have concluded.

azureContainerManifestUri
Type: System.String

The valid URL including SAS token for accessing the Azure Blob Storage Container which contains the block blobs for the manifest and other XML files that describe the package. This location will also be used for the log output. This container cannot be the same as the one used for the azureContainerSourceUri. The SAS token must have been created with only Read, List and Write permissions or the migration job will fail. The SAS token should at least have a lifetime that starts no later than when the job was submitted, until a reasonable time has passed for successful import to have concluded.

azureQueueReportUri
Type: System.String

The valid URL including SAS token for accessing the user provided Azure Queue used for migration job progress notifications. This value can be null if no notification queue will be used during import. If this value is not null and proper access is granted in the SAS token in this URI, it will be used for real time status update.

Return value

Type: Microsoft.SharePoint.Client.ClientResult<Guid>
The unique identifier for the migration job is returned if the job is successfully queued, or if unsuccessful, a null value will be returned. You can get the job status using this unique identifier and the GetMigrationJobStatus method. You can delete the migration job using this identifier and the DeleteMigrationJob method.

The container specified in azureContainerSourceUri must have the following permissions: (SharedAccessBlobPermissions.Read | SharedAccessBlobPermissions.List).

All files in the container must have at least a single snapshot applied to them to ensure that no file modification can occur from the customer during import. Any file that does not have a snapshot will be skipped during import and an error will be thrown, although the job will attempt to continue to import. The import pipeline will use the latest snapshot of the file available at the time of import. The following is an example of code that you could use to create a snapshot on a file after it is uploaded to Azure Blob Storage:

CloudBlockBlob blob = blobContainerObj.GetBlockBlobReference(file);
blob.UploadFromStream(stm);
blob.CreateSnapshot()

All files in the container specified by azureContainerManifestUri must have at least a single snapshot applied to them to ensure that no file modification can occur from the customer during import. Any file that does not have a snapshot will cause failures during import and will throw an error, potentially causing the entire migration job to fail.

The queue specified in azureQueueReportUri should have the following permissions: (SharedAccessQueuePermissions.Add | SharedAccessQueuePermissions.Read | SharedAccessQueuePermissions.Update) Once accepted, the job ID will be written to the notification queue if it was provided and access is valid. The notification queue can be used for multiple migration jobs at the same time, as each job will identify itself in values sent back to the notification queue.

Guid MigrationJobId = TargetSite.CreateMigrationJob(
    TargetWebId,
    azureContainerSourceUri,
    azureContainerManifestUri,
    azureQueueReportUri);

Show: