Copying Wiki Pages To New Wiki Page Library via PowerShell
This process will copy a wiki page from one library to another.
Note: this process will set up the destination page as a "linked" document to the original. I'm sure there is a way to remove the "link" via code, but manually you need to accomplish this by editing the wiki page and clicking "Unlink" in the upper right of the page. Also, any wiki links that you set up pointing to your source wiki as an absolute hyperlink (<a href….>). The link needs to be removed and brackets added back to point to the current wiki.
If you are simply moving the wiki pages, choose .MoveTo() instead of .CopyTo() on the list item object.
$oldSite = new-object Microsoft.SharePoint.SPSite("http://sitename.url.com/");
$oldWeb = $oldSite.AllWebs["/"];
$oldList = $oldWeb.Lists["Wiki Pages"];
"Got Destination List"
"Beginning Copy"
$itemCount = 0
$oldList.Items | foreach-object{
$tempItem = $_;
$tempUrl = "http://newsite.url.com/newWikiPageLibrary/" + $tempItem.Name;
$tempItem.CopyTo($tempUrl);
$tempUrl;
$itemCount = $itemCount + 1;
}
"Done Copying " + $itemCount + " items…";
This entry was posted
on Thursday, September 6th, 2007 at 10:33 pm and is filed under Uncategorized.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Copying Wiki Pages To New Wiki Page Library via PowerShell
This process will copy a wiki page from one library to another.
Note: this process will set up the destination page as a "linked" document to the original. I'm sure there is a way to remove the "link" via code, but manually you need to accomplish this by editing the wiki page and clicking "Unlink" in the upper right of the page. Also, any wiki links that you set up pointing to your source wiki as an absolute hyperlink (<a href….>). The link needs to be removed and brackets added back to point to the current wiki.
If you are simply moving the wiki pages, choose .MoveTo() instead of .CopyTo() on the list item object.
$oldSite = new-object Microsoft.SharePoint.SPSite("http://sitename.url.com/");
$oldWeb = $oldSite.AllWebs["/"];
$oldList = $oldWeb.Lists["Wiki Pages"];
"Got Destination List"
"Beginning Copy"
$itemCount = 0
$oldList.Items | foreach-object{
$tempItem = $_;
$tempUrl = "http://newsite.url.com/newWikiPageLibrary/" + $tempItem.Name;
$tempItem.CopyTo($tempUrl);
$tempUrl;
$itemCount = $itemCount + 1;
}
"Done Copying " + $itemCount + " items…";
This entry was posted
on Thursday, September 6th, 2007 at 10:33 pm and is filed under Uncategorized.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.