Currently trying to import List View WebPart, and use that Code in List Definition/List template. So For That added List View Web Part Manually on a Publishing Page,Trying To import web Part,But There is no option to Import List View Web Part.

Not Find Any Solution How To Use List View web Part in List template or List Definition..

  • can you be more clear pls?
    – Nk SP
    Apr 22 '15 at 7:36
  • my Solution Contain One Publishing SubSite,Having Discussion List in Site Content,trying to Display That List In List View web Part By Activating feature Apr 22 '15 at 9:26
  • IS that Possible Or Need to Create Web Part For That? Apr 22 '15 at 9:27

You can not export a List View Web Part, and you cannot use the resulting xml as a list def/template

The resulting xml of a export would look something like this:

<?xml version="1.0" encoding="utf-8" ?>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
  <type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
  <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
    <property name="ListUrl" type="string">Lists/Kunngjoringer</property>
    <property name="MissingAssembly" type="string">Cannot import this Web Part.</property>
    <property name="JSLink" type="string">~sitecollection/_catalogs/masterpage/AnnouncementJSLink.js</property>
    <property name="XmlDefinition" type="string">&lt;View Name="{D7DB034A-98D9-4D03-8B85-3512DB00D704}" MobileView="TRUE" Type="HTML" Hidden="TRUE" DisplayName="" Url="/avdelinger/Serviceavdelingen/ikt/SitePages/Hjemmeside.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/15/images/announce.png?rev=23" &gt;&lt;Query&gt;&lt;OrderBy&gt;&lt;FieldRef Name="Modified" Ascending="FALSE"/&gt;&lt;/OrderBy&gt;&lt;/Query&gt;&lt;ViewFields&gt;&lt;FieldRef Name="LinkTitle"/&gt;&lt;FieldRef Name="Modified"/&gt;&lt;FieldRef Name="Body"/&gt;&lt;FieldRef Name="Created"/&gt;&lt;FieldRef Name="Author"/&gt;&lt;/ViewFields&gt;&lt;RowLimit Paged="TRUE"&gt;30&lt;/RowLimit&gt;&lt;Aggregations Value="Off"/&gt;&lt;JSLink&gt;clienttemplates.js&lt;/JSLink&gt;&lt;XslLink Default="TRUE"&gt;main.xsl&lt;/XslLink&gt;&lt;Toolbar Type="Standard"/&gt;&lt;/View&gt;</property>

You could use the Xmldefintion as a view though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.