SPScriptlet 2

Within SPScriptlet 2 I'll show how to use SharePoint 2013's REST API to query common SPI properties. In the following example I've built a SharePoint App using Napa, first of all it's important that your App has "Read" permissions on "Web" in order to ask for the web's title. If you aren't yet familiar with the concepts of App- and Host-Web, you should first dig into these topics on MSDN (http://msdn.microsoft.com/en-us/library/fp179925.aspx).

Consider your app has the following HTML

I'm using SP.RequestExecutor, which handles all the cross domain action for me, in order to access the Host-Web from an App-Web. As you can see in figure 2, I'm specifying JSON as expected result for my REST call, SharePoint's REST API is also able to return XML, but in the case of working with JavaScript, it's more natural to deal data in JSON.

If you're looking for the source, check my public github repository at https://github.com/ThorstenHans/SPScriptlets 


comments powered by Disqus