Enable export on web parts in SharePoint (on-premises)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configuration | |
$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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is primarily used for enabling export of the XsltListViewWebPart. The XsltListViewWebPart doesn't allow export by default.