Question

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?

Était-ce utile?

La solution

Yes, it is possible.

Here are the steps:

  1. Export your xslt list view web part.
  2. Open exported .webpart file and find <property name="WebId". There will be empty guid.
  3. Put into the WebId property the ID of your root web.
  4. Go to sub site.
  5. Edit page.
  6. Click Insert -> web part.
  7. Choose "Upload web part".
  8. Select your updated .webpart file.
  9. Click Upload.
  10. After upload click again Insert -> Web part. This time select "Imported web parts" group in the left.
  11. Select your xslt web part and to the sub site.
  12. 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)

Autres conseils

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. :)

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top