0

I am trying to get JSOM to work on a basic aspx page created in Sharepoint Designer. But I have been unable to get SP.ClientContext to work, it is undefined and I get the error: "Sys.InvalidOperationException: Cannot find current web URL information on the page." I have tried using both executeFunc and and SP.SOD.executeOrDelayUntilScriptLoaded with no success. And typing _spPageContextInfo into the console returns undefined so I'm thinking that I need to add something else to my webpage. I added all the js calls included in an ootb SharePoint page so that shouldn't be in issue either.

  • sp.is not really loaded when you execute your JS calls. View page source and search for _spPageContextInfo variable to see if anything is returned. Try _spBodyOnLoadFunctionNames as well. – Akhoy Aug 13 '15 at 18:59
  • sp.js not being loaded wasn't this issue. For some reason adding get_current to the end of var clientContext = new SP.ClientContext fixed the problem although the previous code had worked fine when I was adding it through a content editor web part. – James11 Aug 13 '15 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.