mardi 23 décembre 2014

SOAP AddWebPart: XsltListViewWebPart for a Picture or Document Library



I am trying to add list webparts to a webpartpage via SOAP/REST. I am using the AddWebPart or AddWebPartToZone Methods of the webpartpages.asmx Webservice.


this works (almost to full content) for Link-lists and Discussions, but I can't get it to work for Picture or Document libraries ...


for reference here is the xml-body of my HTTP SOAP Request:



<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://ift.tt/ra1lAU" xmlns:xsd="http://ift.tt/tphNwY" xmlns:soap12="http://ift.tt/18hkEkn">
<soap12:Body>
<AddWebPartToZone xmlns="http://ift.tt/tz2xBC">
<pageUrl>/sites/ideas4u/Pages/abcxyz.aspx</pageUrl>
<webPartXml>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;webParts&gt;
&lt;webPart xmlns=&quot;http://ift.tt/1CAxerD;
&lt;metaData&gt;
&lt;type name=&quot;Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&quot; /&gt;
&lt;importErrorMessage&gt;Cannot import this Web Part.&lt;/importErrorMessage&gt;
&lt;/metaData&gt;
&lt;data&gt;
&lt;properties&gt;
&lt;property name=&quot;ListUrl&quot; type=&quot;string&quot;&gt;/sites/ideas4u/Lists/MyList&lt;/property&gt;
&lt;property name=&quot;MissingAssembly&quot; type=&quot;string&quot;&gt;Cannot import this Web Part.&lt;/property&gt;
&lt;/properties&gt;
&lt;/data&gt;
&lt;/webPart&gt;
&lt;/webParts&gt;
</webPartXml>
<storage>Shared</storage>
<zoneId>Zone 2</zoneId>
<zoneIndex>1</zoneIndex>
</AddWebPartToZone>
</soap12:Body>
</soap12:Envelope>


ie. when "MyList" (given in ListUrl property) is a document or picture library, I always get the following error response when submitting the request:


soap:ReceiverException of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown. An error has occurred.


Do you have an idea as to why it is not working this way? Am I missing something? Thanks for any help!








0 commentaires:

Enregistrer un commentaire