LimitedWebPartManager.ImportWebPart método
Importa uma Web Part de uma cadeia de caracteres no formato .dwp.
Namespace: Microsoft.SharePoint.Client.WebParts
Assemblies: Microsoft.SharePoint.Client.Silverlight (em Microsoft.SharePoint.Client.Silverlight.dll); Microsoft.SharePoint.Client.Phone (em Microsoft.SharePoint.Client.Phone.dll) Microsoft.SharePoint.Client (em Microsoft.SharePoint.Client.dll)
Sintaxe
'Declaração
Public Function ImportWebPart ( _
webPartXml As String _
) As WebPartDefinition
'Uso
Dim instance As LimitedWebPartManager
Dim webPartXml As String
Dim returnValue As WebPartDefinition
returnValue = instance.ImportWebPart(webPartXml)
public WebPartDefinition ImportWebPart(
string webPartXml
)
Parâmetros
webPartXml
Tipo: System.StringA marcação de Web Part para importar.
Valor retornado
Tipo: Microsoft.SharePoint.Client.WebParts.WebPartDefinition
Retorna uma instância de WebPartDefinition que representa a marcação de Web Part para importar.
Exceções
Exceção | Condição |
---|---|
[Microsoft.SharePoint.WebPartPages.WebPartPageUserException] | A marcação de Web Part fornecida não está no formato. dwp ou. WebPart. Código de erro: -1 |
[System.UnauthorizedAccessException] | O usuário atual tem permissões suficientes. Código de erro: -2147024891 |
Comentários
Após importar, a Web Part não é adicionada a uma página de Web Parts. Para adicionar uma Web Part a uma página de Web Parts, use AddWebPart, fornecendo o objeto retornado por esse método.
Quando o escopo for o usuário, o usuário atual deve ter permissões para adicionar e excluir Web Parts personalizadas. Quando o escopo for compartilhado, o usuário atual deve ter permissões para personalizar páginas. Consulte também: AddWebPart.
Ele não deve ser uma referência nula (Nothing no Visual Basic). Ele não deve ser vazio. Ele deve ser XML válido no formato. dwp ou. WebPart.
Esquema
<s:schema targetNamespace="https://schemas.microsoft.com/WebPart/v2" xmlns:wpv2="https://schemas.microsoft.com/WebPart/v2" elementFormDefault="qualified">
<s:element name="WebPart">
<s:complexType>
<s:sequence minOccurs="2" maxOccurs="unbounded">
<s:any namespace="##any" minOccurs="0" maxOccurs="unbounded" />
</s:sequence>
<s:attribute name="ID" type="s:string" use="optional" />
<s:anyAttribute namespace="##any"/>
</s:complexType>
</s:element>
</s:schema>
Esquema
<s:schema elementFormDefault="qualified">
<s:element name="XML">
<s:complexType>
<s:sequence>
<s:element name="ConnDesign">
<s:complexType>
<s:sequence>
<s:element name="ConnectionInfo">
<s:complexType>
<s:sequence>
<s:element name="WebPart" minOccurs="0" maxOccurs="unbounded">
<s:complexType>
<s:sequence>
<s:element name="InterfaceGroups" minOccurs="1" maxOccurs="1">
<s:complexType>
<s:sequence>
<s:element name="InterfaceGroup" minOccurs="0" maxOccurs="unbounded">
<s:complexType>
<s:sequence>
<s:element name="Interfaces">
<s:complexType>
<s:sequence>
<s:element name="Interface">
<s:complexType>
<s:choice minOccurs="0" maxOccurs="1">
<s:element name="InitEventArgs" type="InitEventArgsType"/>
<s:element name="Properties" type="PropertiesType" />
</s:choice>
<s:attribute name="IsASP" type="s:string" />
<s:attribute name="Match" type="s:string" />
<s:attribute name="InterfaceName" type="s:string" />
<s:attribute name="Type" type="s:string" />
<s:attribute name="MenuLabel" type="s:string" />
<s:attribute name="Description" type="s:string" />
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
<s:attribute name="GroupName" type="s:string" use="required" />
<s:attribute name="GroupMenuLabel" type="s:string" use="required" />
<s:attribute name="IsASP" type="s:string" use="required" />
<s:attribute name="Description" type="s:string" use="required" />
<s:attribute name="RunAt" type="runAtType" use="required" />
<s:attribute name="MaxConnections" use="required">
<s:simpleType>
<s:restriction base="s:integer">
<s:enumeration value="-1" />
<s:enumeration value="1" />
</s:restriction>
</s:simpleType>
</s:attribute>
<s:attribute name="AllowCrossPageConnection" type="s:string" use="required" />
<s:attribute name="ConnectionType" type="ConnectionTypeType" use="required" />
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
<s:attribute name="ID" type="s:string" />
<s:attribute name="WebPartID" type="s1:guid" />
<s:attribute name="ConnectionID" type="s1:guid" />
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="Compatibility">
<s:complexType>
<s:sequence>
<s:element name="sWebPart" minOccurs="0" maxOccurs="1">
<s:complexType>
<s:sequence>
<s:element name="sInterfaces">
<s:complexType>
<s:sequence>
<s:element name="int" minOccurs="0" maxOccurs="unbounded">
<s:complexType>
<s:choice minOccurs="0" maxOccurs="1">
<s:element name="InitEventArgs" type="InitEventArgsType"/>
<s:element name="Properties" type="PropertiesType" />
</s:choice>
<s:attribute name="IsASP" type="s:string" />
<s:attribute name="id" type="s:string" />
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="sg" minOccurs="0" maxOccurs="unbounded">
<s:complexType>
<s:sequence>
<s:element name="tParts">
<s:complexType>
<s:sequence>
<s:element name="tWebPart" minOccurs="0" maxOccurs="unbounded">
<s:complexType>
<s:sequence>
<s:element name="tg" minOccurs="0" maxOccurs="unbounded">
<s:complexType>
<s:sequence>
<s:element name="tInterface">
<s:complexType>
<s:sequence>
<s:choice minOccurs="0" maxOccurs="1">
<s:element name="InitEventArgs" type="InitEventArgsType"/>
<s:element name="Properties" type="PropertiesType" />
</s:choice>
<s:element name="mi" minOccurs="1" maxOccurs="1">
<s:complexType>
<s:sequence />
<s:attribute name="xInfo" type="s:string" />
<s:attribute name="id" type="s:string" />
<s:attribute name="isXFormUINeeded" type="s:string" />
</s:complexType>
</s:element>
<s:element name="xForm" minOccurs="0" maxOccurs="1">
<s:complexType>
<s:sequence />
<s:attribute name="type" type="s:string" />
</s:complexType>
</s:element>
</s:sequence>
<s:attribute name="IsASP" type="s:string" />
<s:attribute name="id" type="s:string" />
</s:complexType>
</s:element>
</s:sequence>
<s:attribute name="id" type="s:string" />
<s:attribute name="gLabel" type="s:string" />
<s:attribute name="des" type="s:string" />
<s:attribute name="isMaxedOut" type="s:string" />
<s:attribute name="runAt" type="runAtType">
</s:attribute>
<s:attribute name="ConnectionType" type="ConnectionTypeType">
</s:attribute>
<s:attribute name="IsASP" type="s:string" />
<s:attribute name="isConn" type="s:string" />
</s:complexType>
</s:element>
</s:sequence>
<s:attribute name="ID" type="s:string" use="required" />
<s:attribute name="WebPartID" type="s:string" use="optional" />
<s:attribute name="ConnectionID" type="s:string" use="optional" />
<s:attribute name="pinnedTo" type="runAtType" />
<s:attribute name="title" type="s:string" use="required" />
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
<s:attribute name="des" type="s:string" use="required" />
<s:attribute name="isMaxedOut" type="s:string" />
<s:attribute name="id" type="s:string" use="required" />
<s:attribute name="ConnectionType" type="ConnectionTypeType" use="required" />
<s:attribute name="IsASP" type="s:string" />
<s:attribute name="runAt" type="runAtType" use="required" />
<s:attribute name="gLabel" type="s:string" use="required" />
</s:complexType>
</s:element>
</s:sequence>
<s:attribute name="ID" type="s:string" use="required" />
<s:attribute name="pinnedTo" type="runAtType" use="optional" />
<s:attribute name="WebPartID" type="s:string" use="optional" />
<s:attribute name="ConnectionID" type="s:string" use="optional" />
<s:attribute name="title" type="s:string" />
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
<s:attribute name="id" use="optional">
<s:simpleType>
<s:restriction base="s:string">
<s:enumeration value="MSOConn_Compatibility" />
</s:restriction>
</s:simpleType>
</s:attribute>
</s:complexType>
</s:element>
</s:schema>