When I export the the Table of Contents web part in order to capture the XML necessary for including it on a page, it includes a GUID (in two places) for the Pages list in the current site. Obviously, for a feature to be reusable it must not include a GUID reference to a list. I tried putting in the path "List/Pages" for parameter ListUrl and the name "Pages" for the ListName it didn't work.
I Googled for quite a while looking even for an example of someone including TOC in an Elements.xml file but could not find one. Has anyone successfully included a TOC web part in a feature deployment? Just to be clear, the part does deploy but it throws an error on the page (or a List Not Found exception if I do not change the GUID from the export).
Just to answer the obvious questions: I am deploying it in an Elements.xml file inside of an AllUsersWebPart tag with the XML inside of a CDATA tag. See here:
<AllUsersWebPart WebPartOrder="2" WebPartZoneID="Right"> <![CDATA[ <webParts> <webPart xmlns="http://schemas.microsoft.com/WebPart/v3"> <metaData> <type name="Microsoft.SharePoint.Publishing.WebControls.TableOfContentsWebPart, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> <importErrorMessage>Cannot import this Web Part.</importErrorMessage> </metaData> <data> <properties> <property name="ShowWithSampleData" type="bool">False</property>...
Thanks a bunch.