Find out what Script Links (custom actions) have been added to a site collection in Office 365 / SharePoint Online

A script link is added via a Custom Action (see this post) to a site collection, site, library etc.

I wanted to migrate a site collection in Office 365 with Sharegate, but couldn't find out whether this would include custom actions (our script links).

After the migration I ran the following PowerShell script to find out what was deployed (code from here). 

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")

$siteUrl = "site"
$username = "admin user"
$password = "password"
$SecurePassword = $password | ConvertTo-SecureString -AsPlainText -Force
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)

# SharePoint Online
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $SecurePassword)
$ctx.Credentials = $credentials

$rootWeb = $ctx.Site
$ctx.Load($rootWeb)
$ctx.ExecuteQuery()
$caColl = $rootWeb.get_userCustomActions()
$ctx.Load($caColl)
$ctx.ExecuteQuery()

Write-Host
Write-Host 'Total number of custom actions: '$caColl.Count
$count = 1
$caColl | ForEach-Object {
Write-Host $count')'  $_.Name
$count++
}

As it turns out, Sharegate didn't migrate the custom actions. I emailed the support team and they have confirmed this isn't going to be developed any time soon. For now we can keep deploying it with our old console app. 

Leave a Reply

Your email address will not be published. Required fields are marked *