Automating Configure Send To Connection using PowerShell
-
04-10-2020 - |
Question
In my SP 2013 web application I am having 40+ Record Center Site Collections.For configuring RCs I need to create Send To Connection
and apply the values through the Central Admin UI.
Since its a tedious task and I have to create multiple Send To Connections
, I am looking for the PowerShell script for performing the same.Has anyone done this before?
What's the API in PowerShell for implementing this feature?
Solution
This blog explains how ... and provides powershell script to implement
http://sharepoint-mattharmon.blogspot.co.uk/2012/12/using-powershell-to-create-muliple-send.html
Am posting the contents of the blog:
Using PowerShell to Create Multiple Send to Connections In SharePoint 2010
So having come across a scenario where I was asked to create multiple send to connections for a Records centre design, I was sure it was possible to use PowerShell to help us out here yet again! Now I had seen basic PowerShell scripts to create a single send to rule, so by tweaking this slightly to use a source XML file containing all of the values for my multiple send to rules you can create as many as required with minimal administrative effort. The PowerShell and XML format are below.
PowerShell:
[xml]$SendTos = gc $pwd\sendtorule.xml
$SendTos.SendTos | % {
$webapp = Get-SPWebApplication
$_.WebApplicationUrl.TrimEnd("/")
$_.SendTo | % {
$SendTo = $_
$officialFileHostTemp = $webapp.OfficialFileHosts | ? {
$_.OfficialFileName -eq
$SendTo.OfficialFileName
}
if($officialFileHostTemp -eq $null)
{
[Microsoft.SharePoint.SPOfficialFileHost] $officialFileHost =
New-Object
"Microsoft.SharePoint.SPOfficialFileHost"
$officialFileHost.Action =
[Enum]::Parse([Microsoft.SharePoint.SPOfficialFileAction],
$SendTo.Action)
$officialFileHost.Explanation = $SendTo.Explanation
$officialFileHost.OfficialFileName = $SendTo.OfficialFileName
$officialFileHost.OfficialFileUrl = $url+$SendTo.OfficialFileUrl
$officialFileHost.ShowOnSendToMenu =
[bool]::Parse($SendTo.ShowOnSendToMenu)
$webapp.OfficialFileHosts.Add($officialFileHost)
$webapp.Update()
}
$officialFileHostTemp = $null
}
}
XML Structure
<SendTos WebApplicationUrl="http://WebAppURL">
<SendTo>
<Action>Move</Action>
<Explanation>Move the HR Records site
collection</Explanation>
<OfficialFileName>Move to HR
Records</OfficialFileName>
<OfficialFileUrl>http://siteURL/_vti_bin/officialfile.asmx
</OfficialFileUrl>
<ShowOnSendToMenu>true</ShowOnSendToMenu>
</SendTo>
<SendTo>
<Action>Move</Action>
<Explanation>Move the IT Records site
collection</Explanation>
<OfficialFileName>Move to IT Records</OfficialFileName>
<OfficialFileUrl>http://siteURL/_vti_bin/officialfile.asmx
</OfficialFileUrl>
<ShowOnSendToMenu>true</ShowOnSendToMenu>
</SendTo>
</SendTos>