I have a list on the top level site collection. I would like to show the list items in a webpart on the welcome page of a subsite. I have implemented this already in a CQWP(content query webpart). But I would like to use the listview webpart. Is this possible?
2 Answers
Yes, it is possible.
Here are the steps:
- Export your xslt list view web part.
- Open exported
.webpart
file and find<property name="WebId"
. There will be empty guid. - Put into the
WebId
property the ID of your root web. - Go to sub site.
- Edit page.
- Click Insert -> web part.
- Choose "Upload web part".
- Select your updated
.webpart
file. - Click Upload.
- After upload click again Insert -> Web part. This time select "Imported web parts" group in the left.
- Select your xslt web part and to the sub site.
- Finish! :)
NOTE
By default it is not possible to export xslt web part, but you can enable this option by using following powershell:
$WebUrl = "http://intranet.contoso.com"
$PageUrl = "/Pages/default.aspx"
$WebPartName = "Documents"
# Enables export mode
$Web = Get-SPWeb $WebUrl
$File = $Web.GetFile($Web.ServerRelativeUrl + $PageUrl)
$File.CheckOut()
$Wpm = $File.GetLimitedWebPartManager([System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
$WebParts = $Wpm.WebParts
$WebPart = $WebParts | where { $_.Title -eq $WebPartName }
$WebPart.ExportMode = [System.Web.UI.WebControls.WebParts.WebPartExportMode]::All
$Wpm.SaveChanges($WebPart)
$File.CheckIn("", [Microsoft.SharePoint.SPCheckInType]::MajorCheckIn)
It is not possible via list view webpart, CQWP is the alternative in OOTB way. You can also use custom js code to display data. :)