Skip to content

ShareCoffee.CSOM

Thorsten Hans edited this page Oct 28, 2013 · 2 revisions

ShareCoffee.CSOM provide helpers for working with JavaScript CSOM in SharePoint-Hosted Apps. If you're building Auto-Hosted or Provider-Hosted Apps, you should examine the ShareCoffee.CrossDomain Namespace.

ShareCoffee.CSOM.getHostWeb

When writing SharePoint-Hosted Apps you're often faced with the requirement to interact with data sitting in the HostWeb. You can use ShareCoffee.CSOM.getHostWeb in order to access data sitting in your HostWeb.

Usage

var ctx = SP.ClientContext.get_current(); 
// ctx is for working with your AppWeb

var hostWebUrl = ShareCoffee.Commons.getHostWebUrl();
var hostWeb = ShareCoffee.CSOM.getHostWeb(ctx, hostWebUrl);
// hostWeb is the acutal hostweb

var blogWebUrl = hostWebUrl + "/my-blog";
var blogWeb = ShareCoffee.CSOM.getHostWeb(ctx, blogWebUrl);

Clone this wiki locally