Wednesday, November 11, 2015

Remove the Send To Connectors from Central Admin for a Web Application

Requirement: Remove the Send To Connectors from Central Admin based on names list

PowerShell Script:

-----------------------------------------------------------------------------------------------------------------
clear
Remove-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
Add-PSSnapin Microsoft.SharePoint.Powershell

######################## ENVIRONMENT VARIABLES ########################

$WebApplicationURL = "http://spdd" ## eg: "http://spddwebapp"
 


############################################################################
 
    $officeFileNamesList =@("REC001 Send To Conenctor","REC002 Send To Conenctor")
    $ServiceURL = "_vti_bin/officialfile.asmx"
    write-host "Opening web app object."  
    $WebApp = Get-SPWebApplication $WebApplicationURL
 
[System.Collections.ArrayList]$webOff = $WebApp.OfficialFileHosts
#$off = $WebApp.OfficialFileHosts | where OfficialFileName -eq $officeFileNamesList

write-host "Loop through all OfficialFileNames"
foreach($offFile in $webOff)
{
 
   if($officeFileNamesList -contains $offFile.OfficialFileName)
   {
        $name = $offFile.OfficialFileName
        $WebApp.OfficialFileHosts.remove($offFile)
        $WebApp.Update()
        write-host "Succesfully removed the connector '$name'!"
   }
}


write-host "Completed"

-----------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment

Access to XMLHttpRequest at 'from origin has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. .net core angular

Issue: The angular application was getting error from API that the origin has been blocked by CORS policy. Solution: Make sure that the...