Partager via


LimitedWebPartManager.ImportWebPart - Méthode

Importe un composant WebPart d’une chaîne au format .dwp.

Espace de noms :  Microsoft.SharePoint.Client.WebParts
Assemblys :   Microsoft.SharePoint.Client.Silverlight (dans Microsoft.SharePoint.Client.Silverlight.dll);  Microsoft.SharePoint.Client.Phone (dans Microsoft.SharePoint.Client.Phone.dll)  Microsoft.SharePoint.Client (dans Microsoft.SharePoint.Client.dll)

Syntaxe

'Déclaration
Public Function ImportWebPart ( _
    webPartXml As String _
) As WebPartDefinition
'Utilisation
Dim instance As LimitedWebPartManager
Dim webPartXml As String
Dim returnValue As WebPartDefinition

returnValue = instance.ImportWebPart(webPartXml)
public WebPartDefinition ImportWebPart(
    string webPartXml
)

Paramètres

  • webPartXml
    Type : System.String

    Le balisage de composant WebPart à importer.

Valeur renvoyée

Type : Microsoft.SharePoint.Client.WebParts.WebPartDefinition
Renvoie une instance de WebPartDefinition représentant le balisage de composant WebPart à importer.

Exceptions

Exception Condition
[Microsoft.SharePoint.WebPartPages.WebPartPageUserException]

Le balisage de composant WebPart fourni n'est pas au format .dwp ou .webpart. Code d'erreur : -1

[System.UnauthorizedAccessException]

L'utilisateur actuel dispose des autorisations suffisantes. Code d'erreur : -2147024891

Remarques

Après avoir importé, le composant WebPart n'est pas ajouté à une Page de composants WebPart. Pour ajouter un composant WebPart à une Page de composants WebPart, utilisez AddWebPart, qui fournit l'objet retourné par cette méthode.

Lorsque l'étendue est utilisateur, l'utilisateur actuel doit disposer des autorisations à ajouter et supprimer des composants WebPart personnalisés. Quand l'étendue est partagé, l'utilisateur actuel doit disposer des autorisations pour personnaliser des pages. Voir aussi : AddWebPart.

une référence Null (Rien dans Visual Basic)ne doit pas être. Il ne doit pas être vide. Il doit être valide XML au format .dwp ou .webpart.

Schéma

<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>

Schéma

<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>

Voir aussi

Référence

LimitedWebPartManager classe

LimitedWebPartManager - Membres

Microsoft.SharePoint.Client.WebParts - Espace de noms