Home > PowerShell, SharePoint 2010 > Updating SharePoint 2010 Document Libraries Custom Send To Location URL using PowerShell

Updating SharePoint 2010 Document Libraries Custom Send To Location URL using PowerShell

I recently went  through the painful process of migrating/upgrading our Microsoft CRM/TMT SharePoint 2007 Web Application to SharePoint 2010.  In doing so I had to migrate from one domain to another.  With CRM/TMT there are literally thousands of sites with thousands of document libraries which are created dynamically through CRM.  Since most of all the document libraries within CRM utilize Custom Send To Locations I needed to update all document libraries to point to the new domain URL location.  Below is the PS script I generated to loop through all Site Collections/Webs/ and Document libraries to update the Custom Send To Locations.

————————————————————————————————————————————————————————————————————————–

$webapp = Get-SPWebApplication “http://crm2010”
foreach ($s in $webapp.Sites)
{

Write-host $s.Url
foreach ($web in $s.AllWebs)
{

Write-Host $web.ServerRelativeURL

foreach ($list in $web.Lists)
{

if ($list.BaseType -eq “DocumentLibrary”)

{

if ($list.Title -eq “Public Workspace” -or $list.Title -eq “Response Documents” -or $list.Title -eq “Original Documents”)

{

#Get $list.SendToLocationName and stores it in $SendToLocationName variable
$SendToLocationName = $list.SendToLocationName;

#Sets $list.SendToLocationName to $SendToLocationName variable value.
$list.SendToLocationName = $SendToLocationName;

Write-Host $SendToLocationName;

#Store $list.SendToLocationURL in $replaceURLstring variable.
$replaceURLstring = $list.SendToLocationUrl;

#Sets $list.SendToLocationURL to new URL.  Replacing crmsp2007 with crmsp2010
$replaceURLstring = $replaceURLstring.Replace(“crmsp2007″,”crmsp2010”);
$list.SendToLocationURL = $replaceURLstring;

Write-Host $replaceURLstring;

#Update List$list.Update()

}

}

}

}

}

 

 

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: