0

I saw references to the SharePointPlus library and am keen to try it out. Unfortunately i have not been able to make this work. The script below is in the HTML source of my webpart. Would appreciate your inputs.

i do not see the alert not the console log. i am not sure if there is any configuration missing

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js">
<script src="https://cdn.jsdelivr.net/npm/sharepointplus@5.0.0/sharepointplus-5.0.min.js">

<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@7/dist/polyfill.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){
ExecuteOrDelayUntilScriptLoaded(function(){
   console.log("Test");
   $SP().list("APP Projects").get({fields:"ID"}, function(data) {
   alert("Number of items: "+data.length)
   })

   },"sp.js");
   });
   </script>
  • What is exactly not working...? – Boland Jan 8 '18 at 1:45
  • Hello. i do not see the alert not the console log. i am not sure if there is any configuration missing – SP_Newbie Jan 8 '18 at 2:06
0

Old message, but here some tips...

You don't need to put SharepointPlus code inside $(document).ready or ExecuteOrDelayUntilScriptLoaded. It can work right away.

Then, the "APP Projects" must be the correct name of a list in the current website where the code is displayed.

Finally, you can use Promise:

<script type="text/javascript">
$SP().list("APP Projects").get({fields:"ID"})
.then(function(data) {
  alert("Number of items: "+data.length)
})
</script>

Your Answer

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

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