Has anybody successfully set the JSLink for SP Online? I usually set it through Powershell on the view itself but that Command isn't available Online


I don't want to set the JSLink on a List View Web Part properties, it doesn't work. I've had this same problem with on-prem SP.

1 Answer 1


Since SharePoint 2013 supports several sets of APIs, you could utilize client APIs (CSOM/REST) in PowerShell.

How to set View.JSlink property using PowerShell in SharePoint Online

CSOM version

The following example demonstrates how to specify View.JSlink property via CSOM in PowerShell:


Function Get-SPOCredentials([string]$UserName,[string]$Password)
   if([string]::IsNullOrEmpty($Password)) {
      $SecurePassword = Read-Host -Prompt "Enter the password" -AsSecureString 
   else {
      $SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force
   return New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)

Function Configure-ListView([Microsoft.SharePoint.Client.ClientContext]$Context, [string]$ListTitle,[string]$ViewTitle)
    $list = $Context.Web.Lists.GetByTitle($ListTitle)
    $view = $list.Views.GetByTitle($ViewTitle)
    $view.JSLink = "~sitecollection/SiteAssets/Tasks.js"


$UserName = "[email protected]"
$Password = Read-Host -Prompt "Enter the password"    
$WebUrl = "https://contoso.sharepoint.com"

$Context = New-Object Microsoft.SharePoint.Client.ClientContext($WebUrl)
$Context.Credentials = Get-SPOCredentials -UserName $UserName -Password $Password
Configure-ListView -Context $Context -ListTitle "Tasks" -ViewTitle "All Tasks"

It is also possible to accomplish using REST API, since this API could be consumed in PowerShell, follow this article for a more details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.