How to Add a ScriptLink on the Host Web from a SharePoint Hosted App with JSOM

105 Views Asked by At

I'm trying to add a scriptLink on the Host web from a SharePoint hosted app using JSOM.

I found some articles that give the samples to do this (e.g. http://booden.net/JsomAddScriptLinkOnHostWeb.aspx), but it doesn't work anymore.
Even though I've given the full permission to the app, I still got this error message:

Request failed: Access denied. You do not have permission to perform this action or access this resource.

Is it still possible to do this?

1

There are 1 best solutions below

0
Ari Gunawan On

Apparently, the error occurs when I run the solution from visual studio. Once I publish the app then upload and install the app, it works as expected.

As a conclusion, it is possible to add a ScriptLink on the Host Web from a SharePoint Hosted App using JSOM.