Building SharePoint 2013 Apps

When building SharePoint 2013 Apps, you will have to use either the JavaScript object model (JSOM) or the .NET client-side object model (CSOM).  Both of these APIs follow a batch-oriented programming model.  That is, you call some methods which queue up data queries and other operations and then you call a method to execute the queued methods.

For example, using the JSOM model in JavaScript, if you needed to load a web’s content type collection, you would do something like:

JSOM #1

This code block queues requests to get and load the web’s content type collection. The commands are then executed using the executeQueryAsync method. The contentTypes variable is not populated until the executeQueryAsync method is executed.

This model works quite well but you have to be careful when loading collections of objects.  In the above example, every content type property will be returned even if you aren’t going to use them.  The responses can be quite large which will negatively affect performance.  Microsoft knew this so they included the ability to control the properties that are returned when loading a collection.

JSOM #2

In this example, I’ve told the load method to only pull back the Name and Id properties.  It makes sense that this would perform better but how much better?  I decided to use Fiddler to find out.  If you haven’t used Fiddler yet, it’s available for free (at this time) at http://www.telerik.com/fiddler.  Fiddler is a web debugging proxy that logs HTTP(s) traffic between your computer and the Internet.

Below is a simple SharePoint 2013 Client Web Part that displays a web’s content types.  In this example, I use the load() method to load all properties.

JSOM #3

The Fiddler response to the executeQueryAsync() call is:

JOS #4

As you can see, the request to load the content types and return the data took 1.6 seconds.  The JSON response was 257KB.

I then modified the example’s load() method by adding the “Include(Name, Id)” string as the second parameter as shown below.

JSOM #5

Here are the Fiddler results for the executeQueryAsync() call:

JOS #6

This request executed in 0.149 seconds and the response was 5KB.  This second test executed in 9% of the time and returned 1.9% of the data.  Quite an improvement!

So the next time you’re creating a SharePoint application that uses JSOM or CSOM, be careful with how much data you pull back.  You can see from the above numbers that your users will be happier with the improved performance.

You can download the sample app part from here.

Raymond Riopel

Yammer or SharePoint 2013 for the Social Enterprise?

In buying Yammer last year, Microsoft pretty much acknowledged that it dropped the ball on social and needed to bring in external reinforcements. Acquiring Yammer also fits well with the new cloud services approach of office 365. The vision according to Microsoft is cloud first. They love the ability to roll out changes and fixes on a faster pace, but mostly, they love the business model.

At the same time SharePoint 2013 includes a much improved set of tools for social collaboration including a brand new activity stream app. So what should you use? Yammer or SharePoint 2013 built in social tools?

Here is the timeline and guidance as provided by Microsoft:

If you are a SharePoint cloud user – go with Yammer. There is a basic integration available now with the promise of single signon in the fall. They also promise updates every 90 days.

If you are an on-premise user (and most companies are since SharePoint 2010 online was not very good..) and moving to SharePoint 2013, the decision is a bit more complicated.

Yammer offers an existing app for SharePoint 2010 that can be integrated in if you are a paying Yammer customer, but nothing yet announced for SharePoint 2013.

So the only option really is to deploy the SharePoint social services unless you are already using Yammer Enterprise and can wait if/until they support 2013.

The longer term roadmap beyond 2014 is cloudy as well. Yammer is a cloud offering and will clearly be tightly integrated into office 365 but as much as Microsoft would like to, not everyone will get on their cloud platform that quickly. In all likelihood, Microsoft will continue to support and even release new version of SharePoint on premise but certain aspects will likely not be improved much and Social seems one of them. Yammer will become a selling point and an incentive to go cloud.

Another interesting point is how will this work for Hybrid Deployments and how migration to the cloud will handle the social data or be able to migrate it into Yammer. We’ll have to wait and see..

For more details see the official blog post from Microsoft and an interesting post on ZDNET on how Microsoft approached social for their internal Intranet, apparently using both models and giving users the choice when creating a collaboration site based on their primary need – document based (SharePoint) or activity stream (Yammer). Now, if only one site could do both..