I use sharepoint online, I have a problem whe I load my page. I want to show a list with Rest/Api but I have this message : TypeError: SP.RequestExecutor is not a constructor
I think scripts is not loaded, how I can do ?
I use sharepoint online, I have a problem whe I load my page. I want to show a list with Rest/Api but I have this message : TypeError: SP.RequestExecutor is not a constructor
I think scripts is not loaded, how I can do ?
You can find how to load and use SP.RequestExecutor on this link (which i will not mention here).
Another way to load it though is the following:
Make sure your app has "sp.js" registered as such:
<asp:Content ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
<SharePoint:ScriptLink Name="sp.js" runat="server" OnDemand="true" LoadAfterUI="true" Localizable="false" />
<!-- other scripts / styles here -->
</asp:Content>
To load the SP.RequestExecutor:
ExecuteOrDelayUntilScriptLoaded(function () {
var scriptbase = _spPageContextInfo.siteAbsoluteUrl + "/_layouts/15/";
// Load the js files and continue to the successHandler
$.getScript(scriptbase + "SP.RequestExecutor.js", function () {
console.log("request executor is now loaded");
// Logic here
});
}, "sp.js");
Add reference to your aspx or html page
<script type="text/javascript" src="/_layouts/15/SP.RequestExecutor.js"></script>