Hi anonymous user,
Please use SPView.JSLink property to set JSLink url to a list view, here is a sample code for your reference:
using (SPSite site=new SPSite("http://sp/sites/dev"))
{
SPWeb web = site.OpenWeb();
SPList list = web.Lists["PBIList"];
SPView view = list.Views["All Items"];
view.JSLink = "~sitecollection/SiteAssets/jslink_Header1.js";
view.Update();
}
Reference:
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.