Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Enable export on web parts in SharePoint (on-premises)
# Configuration
$WebUrl = ""
$PageUrl = "/Pages/default.aspx"
$WebPartName = "Documents"
# Enables export mode
$Web = Get-SPWeb $WebUrl
$File = $Web.GetFile($Web.ServerRelativeUrl + $PageUrl)
$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
$File.CheckIn("", [Microsoft.SharePoint.SPCheckInType]::MajorCheckIn)

This comment has been minimized.

Copy link
Owner Author

@aflyen aflyen commented Oct 28, 2015

This is primarily used for enabling export of the XsltListViewWebPart. The XsltListViewWebPart doesn't allow export by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment