locked
Update Send To Connections via PowerShell RRS feed

Answers

  • Found the answer

    $WebApp =Get-SPWebApplication http://Webappname/

    $stuff = $WebApp.OfficialFileHosts

    $bit = $webapp.officialfilehosts | where-object {$_.OfficialFileName -eq 'Existing connection name'}

    $bit.OfficialFileName='New Connection name';

    $bit.OfficialFileUrl='New URL'

    $bit.Explanation='New Explanation'   

    $webapp.Update()

    • Marked as answer by SP Learner Thursday, August 29, 2019 7:51 PM
    Thursday, August 29, 2019 7:51 PM

All replies

  • Hi SP Learner,

    In Central Administration web application level, SharePoint not provide update function for Send To Connections, if you want to have a different Display Name and Send To Url, you can create a new one instead like this using PowerShell:

    #Get the Web Application
    $WebApp = Get-SPWebApplication "http://sharepoint.crescent.com"
     
    $SPOfficialFileHost = New-Object Microsoft.SharePoint.SPOfficialFileHost
    #Set Send to Options#
    #Send to Connection Name
    $SPOfficialFileHost.OfficialFileName = "Project Directory"
    #Send to Target location
    $SPOfficialFileHost.OfficialFileUrl = "http://sharepoint.crescent.com/teams/PMO/ProjectDir/_vti_bin/officialfile.asmx"
    $SPOfficialFileHost.ShowOnSendToMenu = $true
    #Send to Operation
    $SPOfficialFileHost.Action=[Microsoft.SharePoint.SPOfficialFileAction]::Copy
    $SPOfficialFileHost.Explanation = "Send to connection for Project submission"
    $WebApp.OfficialFileHosts.Add($SPOfficialFileHost);
    $WebApp.Update()
    

    Reference:

    Create Send To Connection with PowerShell

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, August 29, 2019 7:58 AM
  • Hi Jerry,

    It is possible. I found the solution but still trying to optimize it.

    $WebApp = Get-SPWebApplication http://Webappname/
    $stuff = $WebApp.OfficialFileHosts

    foreach ($bit in $stuff){

    if ($bit.OfficialFileName -eq 'Your existing connection name')

     { $bit.OfficialFileName='Your new connection name';
       $bit.OfficialFileUrl='Your new url'
       $bit.Explanation='Your new explanation'
       $webapp.Update()
     }

    }

     Above code works perfectly fine and does the job but ideally I don't need to loop the whole list. I can directly assign using officialFileName but I am facing challenge with that. If you or anyone can help me in eliminating for loop that will be great help.


    Thanks,
    Thursday, August 29, 2019 7:02 PM
  • Found the answer

    $WebApp =Get-SPWebApplication http://Webappname/

    $stuff = $WebApp.OfficialFileHosts

    $bit = $webapp.officialfilehosts | where-object {$_.OfficialFileName -eq 'Existing connection name'}

    $bit.OfficialFileName='New Connection name';

    $bit.OfficialFileUrl='New URL'

    $bit.Explanation='New Explanation'   

    $webapp.Update()

    • Marked as answer by SP Learner Thursday, August 29, 2019 7:51 PM
    Thursday, August 29, 2019 7:51 PM