AddWebPart to page

Jan 17, 2013 at 11:48 PM

I'm trying to use the the AddWebPart method of the WebPartPages web service.  I can get the example to work for a content editor web part, no issue there. What I really need to do is to add web parts of existing document libraries.

I can't see to find any documentation on what the XML syntax is for document libraries. Has anyone used this before or know where I can look to find the XML required to add a web part to a page for an existing document library?

This is XML I've tried so far to no avail:

 

<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2">
  <Title>Project Files</Title>
  <FrameType>Default</FrameType>
  <Description />
  <IsIncluded>true</IsIncluded>
  <ZoneID>Zone 3</ZoneID>
  <PartOrder>4</PartOrder>
  <FrameState>Normal</FrameState>
  <Height />
  <Width />
  <AllowRemove>true</AllowRemove>
  <AllowZoneChange>true</AllowZoneChange>
  <AllowMinimize>true</AllowMinimize>
  <AllowConnect>true</AllowConnect>
  <IsVisible>true</IsVisible>
  <DetailLink />
  <HelpLink />
  <HelpMode>Modeless</HelpMode>
  <Dir>Default</Dir>
  <PartImageSmall />
  <MissingAssembly>Cannot import this Web Part.</MissingAssembly>
  <PartImageLarge />
  <IsIncludedFilter />
  <Assembly>Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
  <TypeName>Microsoft.SharePoint.WebPartPages.ListFormWebPart</TypeName>
  <ListName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm{D1C5BACF-34F9-4C0D-96C8-85E035663BDC}</ListName>">">{D1C5BACF-34F9-4C0D-96C8-85E035663BDC}</ListName>
  <ListId xmlns="http://schemas.microsoft.com/WebPart/v2/ListFormD1C5BACF-34F9-4C0D-96C8-85E035663BDC</ListId></WebPart>">">D1C5BACF-34F9-4C0D-96C8-85E035663BDC</ListId>
</WebPart>
Jan 18, 2013 at 12:14 AM

Think I finally found my answer, http://www.glynblogs.com/2011/04/exporting-the-xslt-list-view-web-part-in-sharepoint-2010.html