I was thinking how to name that post, and it reminds me how much time I spent trying to get list items from Host Web, or update/insert items somewhere in sub site of Host Web, or another one, when you are trying to get Project Online Context and even you referenced all .js files, it is still complaining. All that happened to me, and one day, I just found a really good solution, which I decided to share today.

I think most of you, at least, heard about Lightswitch and you can find couple posts on my blog about that awesome framework, built by Microsoft. The thing is, guys made it really easy to build apps for SharePoint and I was interested in how they did it. It is always a good practice to see how the monsters of SP made it, so you can learn something.

After 10-20 minutes of reverse engineering, I came up with a file called SPLoader.js. You can grab the file here:


So, after all you need to do is to reference that file.

Here is how to use it. Let’s say you need to query List in Provider hosted app:


If you look closer at SpLoader file, you will find that  all magic is happening  here;

You can see that the function loads all .js files in the correct order. (Example: PS.js library will be loaded the last.). You can easily add you code to load UserProfile or Search libraries as well.

Happy coding!




Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">