What is the best way to write sample snippets of code

  1. Visual studio 2012- Create a SharePoint App project.
    Issue :-Every time you need to query the list on the host web you need to query the Host web. This option seems a bit OOT

  2. Write code in firebug / developer tools

    • Finding strange caching issue as above
    • At Times I get the above code working and at times I get the SPclientContext is not a constructor error.

If Firebug or developer tools are the right approach, then are there any good practices and pitfalls to avoid.

  1. NAPA - No Debug option other than alert or open in Visual studio
  2. Sharepoint designer - No debug option other than alert
  • With your browsers dev tools you have a wide specter of debugging options (such as break points) available in point 1, 2, 3 and 4.
    – eirikb
    Commented Jan 19, 2015 at 6:29

1 Answer 1


When using CSOM you should make sure the libraries are loaded before you start using it.

When you use developer tool in the browser, all the libraries might have loaded already.

So do it in the following format.


function CustomStartFunction() {
    //CSOM Code goes here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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