- Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
- $url = "http://adeb.crayondev.dev/";
- $page = "Sider\nyhetsarkiv.aspx";
- $exportFolderPath = "C:\GIT\";
- function ExportAllWebParts($siteUrl,$pageUrl,$exportFolderPath)
- {
- $web = Get-SPWeb $url
- $file = $web.GetFile($page);
- #$file.CheckIn($false);
- $file.CheckOut();
- $wpm = $web.GetLimitedWebPartManager($file.Url, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
- $i=0;
- foreach($wp in $wpm.WebParts)
- {
- $i++;
- Write-Host "Exporting " $wp.Title;
- $wp.ExportMode="All";
- $exportPath = $($exportFolderPath + "\" + $wp.Title.Replace(":","_") + $i + ".xml");
- $xwTmp = new-object System.Xml.XmlTextWriter($exportPath,$null);
- $xwTmp.Formatting = 1;#Indent
- $wpm.ExportWebPart($wp, $xwTmp);
- $xwTmp.Flush();
- $xwTmp.Close();
- Start-Process "notepad.exe " $exportPath;
- }
- $file.CheckIn($false);
- }
- ExportAllWebParts $url $page $exportFolderPath;
Undefined
By: Guest | Date: Sep 25 2014 09:13 | Format: None | Expires: never | Size: 1.01 KB | Hits: 956
Latest pastes
1 days ago
2 days ago
5 days ago
6 days ago
6 days ago