SPExport Class
Supports export of specified content from a source SharePoint Foundation site collection to a CAB file (with .cmp file extension) in XML format.
Inheritance Hierarchy
System.Object
Microsoft.SharePoint.Deployment.SPDeployment
Microsoft.SharePoint.Deployment.SPExport
Namespace: Microsoft.SharePoint.Deployment
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SPExport _
Inherits SPDeployment
'Usage
Dim instance As SPExport
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPExport : SPDeployment
Remarks
This class participates with other classes in the Deployment namespace to support import, export, publication, and migration of Windows SharePoint content, as well as supporting backup and restore capabilities.
You can initiate an export operation by first initializing an instance of the Microsoft.SharePoint.Deployment.SPExportSettings class with the required export settings and then passing the SPExportSettings object to the constructor of SPExport class; you then call the SPExport.Run method.
Examples
The following code example demonstrates how to perform a full export of an entire site collection.
[C#]
SPExportSettings settings = new SPExportSettings();
settings.SiteUrl = "https://servername:80";
settings.FileLocation = @"c:\exportdata";
settings.BaseFileName = "exportfile.cmp";
settings.FileCompression = true;
settings.ExportMethod = SPExportMethodType.ExportAll;
SPExport export = new SPExport(settings);
export.Run();
The following code example demonstrates how to perform an incremental export. Notice that the code sets the ExportMethod property to ExportChanges and then provides a change token.
[C#]
settings.ExportMethod = SPExportMethodType.ExportChanges;
settings.ExportChangeToken = "1;1;87a71761-2987-48eb-9d29-48428270e01;632937036861200000;5512";
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.