共用方式為


AdministrationMetadataCatalog.ImportPackage Method (String, String , PackageContents, String, Boolean, Guid)

Imports the model given in the XML into the Metadata Store using the specified package contents, setting, update model, and job ID.

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

Syntax

'Declaration
Public Function ImportPackage ( _
    xml As String, _
    <OutAttribute> ByRef errors As String(), _
    packageContents As PackageContents, _
    settingId As String, _
    updateModel As Boolean, _
    jobId As Guid _
) As Model
'Usage
Dim instance As AdministrationMetadataCatalog
Dim xml As String
Dim errors As String()
Dim packageContents As PackageContents
Dim settingId As String
Dim updateModel As Boolean
Dim jobId As Guid
Dim returnValue As Model

returnValue = instance.ImportPackage(xml, _
    errors, packageContents, settingId, _
    updateModel, jobId)
public Model ImportPackage(
    string xml,
    out string[] errors,
    PackageContents packageContents,
    string settingId,
    bool updateModel,
    Guid jobId
)

Parameters

  • xml
    Type: System.String

    The XML string from which to import the metadata model.

  • errors
    Type: []

    A list of the noncritical errors encountered during the import process.

  • settingId
    Type: System.String

    The identifier of the Metadata Store partition in which the properties, localized names and access control entries of the metadata objects will be created.

  • updateModel
    Type: System.Boolean

    If true, the model definition that was already in the store should be updated to contain only the external content types in the given XML. This method throws an exception if the model is not in the database. If false, the model is created for the first time, and this method throws an exception if the model already exists in the database. When the model is being updated, the external content types that were previously in the model are not deleted. The caller must clean them up separately.

  • jobId
    Type: System.Guid

    A GUID that is used to track this import process.

Return Value

Type: Microsoft.SharePoint.BusinessData.Administration.Model
The imported model.

Exceptions

Exception Condition
ArgumentNullException

The xml parameter is a null reference (Nothing in Visual Basic).

PackageFormatException

The format of the metadata XML is invalid.

Examples

Code Snippet: Import a BDC Model Into the Metadata Store

See Also

Reference

AdministrationMetadataCatalog Class

AdministrationMetadataCatalog Members

ImportPackage Overload

Microsoft.SharePoint.BusinessData.Administration Namespace