Share via


SPSolutionExporter.ExportWebToGallery method (SPWeb, String, String, String, SPSolutionExporter.ExportMode, Boolean, Action<String>, Boolean)

Exports the specified web as a solution to the Solution Gallery.

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

Syntax

'Declaration
Public Shared Function ExportWebToGallery ( _
    web As SPWeb, _
    solutionFileName As String, _
    title As String, _
    description As String, _
    exportMode As SPSolutionExporter.ExportMode, _
    includeContent As Boolean, _
    solutionPostProcessor As Action(Of String), _
    activateSolution As Boolean _
) As String
'Usage
Dim web As SPWeb
Dim solutionFileName As String
Dim title As String
Dim description As String
Dim exportMode As SPSolutionExporter.ExportMode
Dim includeContent As Boolean
Dim solutionPostProcessor As Action(Of String)
Dim activateSolution As Boolean
Dim returnValue As String

returnValue = SPSolutionExporter.ExportWebToGallery(web, _
    solutionFileName, title, description, _
    exportMode, includeContent, solutionPostProcessor, _
    activateSolution)
public static string ExportWebToGallery(
    SPWeb web,
    string solutionFileName,
    string title,
    string description,
    SPSolutionExporter.ExportMode exportMode,
    bool includeContent,
    Action<string> solutionPostProcessor,
    bool activateSolution
)

Parameters

  • solutionFileName
    Type: System.String

    The name of the solution file (.wsp).

  • title
    Type: System.String

    The title of the Web template. The value passed in this parameter is used as the value of the Title attribute in the Project element of an Onet.xml file.

  • description
    Type: System.String

    Detailed information that describes the Web template. The value passed in this parameter is used as the value of the Description attribute in the WebTemplate element in an element manifest and also for the value of the Description attribute in the Project element of an Onet.xml file.

  • exportMode
    Type: Microsoft.SharePoint.SPSolutionExporter.ExportMode

    Specifies how much of the Web site to export. Pass FullReuse if you intend to use the Web template within the same site collection as the exported Web site; otherwise, pass FullPortability.

  • includeContent
    Type: System.Boolean

    true to include the contents of all lists and document libraries in the Web site; otherwise false.A string containing the URL of the new solution file in the Solution Gallery. If a solution could not be created, an empty string is returned.

  • solutionPostProcessor
    Type: System.Action<String>

    A delegate to make changes to the content of the solution file.

  • activateSolution
    Type: System.Boolean

    true to activate solution; otherwise, false.

Return value

Type: System.String
A string containing the URL of the new solution file in the Solution Gallery. If a solution could not be created, an empty string is returned.

Remarks

This method attempts to copy the new solution file into the Solution Gallery using the specified file name. If a file with this name already exists, then a series of "FileName-2.wsp", "FileName-3.wsp" attempts are made in an effort to find a unique file name.

The content of the solution file is first created in a temporary directory in the local file system. You can change the content (such as removing certain files, changing manifest files) of the solution file by using the solutionPostProcessor delegate.

See also

Reference

SPSolutionExporter class

SPSolutionExporter members

ExportWebToGallery overload

Microsoft.SharePoint namespace