Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand

Archive for November, 2015

REST or JSOM – Scenario based Usage

Posted by Jean Paul on November 20, 2015

In this article we can see the when to use REST and when to use JSOM depending on the scenario.



REST is Representational State Transfer. REST is an architectural style and uses HTTP protocol. SharePoint 2013 onwards REST API is supported.

For filtering data, REST supports OData protocol.

One of the example of REST URL is given below:


You can find more REST examples from References.


JSOM (JavaScript Object Model) is CSOM (Client Side Object Model) of interacting with SharePoint. This programming way is available from SharePoint 2010 onwards. JSOM Programming requires the following:

1. Deeper understanding of the SharePoint CSOM API

2. Reference to JSOM JavaScript files

3. CAML query used for filtering

Following is an example code for JSOM:

var listTitle = “Contacts”;

using(var context = new ClientContext(“http://url”))


var list = context.Web.Lists.GetByTitle(listTitle);





You can see References for source-code example.

REST Advantages

Following are the advantages of going with REST:

1. REST web requests are easier to work with that we can use Browser to test them

2. No overheads of WSDL creation Or Detailed SharePoint knowledge required

3. No overheads of tying up with Service Reference

4. Direct Calls for fetch, insert, update, delete, find operations

5. Better Interoperability supporting different clients on different platforms, programming models

In this way REST is more preferred among SharePoint Programmers.

JSOM Advantages

Following are the advantages of JSOM over REST which I would prefer to use only in particular scenarios.

1. JSOM supports Batching.

Batching is the technique of tying multiple queries and sending to server. In this way, the roundtrip can be reduced to one.

Scenario: You have a Web Page where 10 list items needs to be loaded. In the case of REST, this will require 10 roundtrips to the server. Right?

But if you are using JSOM, you can wrap all the queries into one roundtrip. Invoke the Load() method multiple times as shown below.




Then we can call the ExecuteQuery() method which will actually send the query to the server. This is the advantage of Batching in JSOM.



Chattier is another term which means the Opposite of Batching. Chattier means it requires chat like request-response between client & server. So REST is chattier & JSOM not.



In this article we can have explored the usage of REST vs. JSOM based on scenario.

Posted in SharePoint, SharePoint 2013 | Tagged: , | 1 Comment »

Sign In as Different User in SharePoint 2013

Posted by Jean Paul on November 19, 2015

In this post I will take you through one common real-life scenario in SharePoint 2013.


You are working on a SharePoint site. For testing a page, you need to Sign In as a different user. SharePoint only provides Sign Out menu item.


On clicking the Sign Out you will get signed out & the browser may prompt to close. Once reopening the browser you will be again signed in as the old user. Problem repeats!

How to Sign In as a different user?


SharePoint 2010 had a menu item called Sign in as different user. But Microsoft removed it in SharePoint 2013 for various reasons.


Following are few solutions to apply for the current situation.

Solution 1: URL

You can explicitly use the Close Connection Url with the parameter.


For example if your Site URL is http://server/site

Your final URL will be:


On using the URL you will be prompted with the Sign In box.


Hope this will solve your problem.

Solution 2: IE Settings

Alternatively, you can go to the IE Settings to change the Login option as shown below.

Internet Options > Security (tab) > Custom Level (button) > Prompt for user name and password.



If your Administrator is managing the settings, you will not be able to change it.


In this post we have explored a common real life scenario in SharePoint 2013.

Posted in SharePoint, SharePoint 2013 | Tagged: , | Leave a Comment »

JSOM Batching Code Example

Posted by Jean Paul on November 12, 2015

In this article we can explore a sample JSOM code which will reveal the Batching advantage of JSOM.


Batching is one core advantage of JSOM over REST API. Batching minimizes the roundtrips involved by grouping all the queries together.

For example, if you have 10 SharePoint lists to be queried from a page, REST API requires 10 roundtrips which would be taking around 20 seconds. Here we can use JSOM to combine the requests into 1 roundtrip there by reducing the time to 2 seconds. (90% time reduction)


Network Roundtrip occupies the majority time involved in a web page loading.

JSOM Example

In this example we are using 2 lists named Contacts A and Contacts B. Please create these lists from template Contacts & add one item in each.



Now create a new page & add a content editor web part. Insert following code into it. Change the server URL before saving.

var siteUrl = ‘http://server‘;

$(document).ready(function () {

    ExecuteOrDelayUntilScriptLoaded(retrieveListItems, “sp.js”);



function retrieveListItems() {

   var clientContext = new SP.ClientContext(siteUrl);

    var oList = clientContext.get_web().get_lists().getByTitle(‘Contacts A’);

    var camlQuery = new SP.CamlQuery();

    camlQuery.set_viewXml(” +


    this.collListItem = oList.getItems(camlQuery);


    var oList2 = clientContext.get_web().get_lists().getByTitle(‘Contacts B’);

    var camlQuery2 = new SP.CamlQuery();

    camlQuery.set_viewXml(” +


    this.collListItem2 = oList2.getItems(camlQuery2);


  clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));       


function onQuerySucceeded(sender, args) {

    var listItemInfo = ”;

    var listItemEnumerator = collListItem.getEnumerator();

    while (listItemEnumerator.moveNext()) {

        var oListItem = listItemEnumerator.get_current();

        listItemInfo += ‘nID: ‘ + oListItem.get_id() +

            ‘nTitle: ‘ + oListItem.get_item(‘Title’);



    var listItemInfo2 = ”;

    var listItemEnumerator2 = collListItem2.getEnumerator();

    while (listItemEnumerator2.moveNext()) {

        var oListItem2 = listItemEnumerator2.get_current();

        listItemInfo2 += ‘nID: ‘ + oListItem2.get_id() +

            ‘nTitle: ‘ + oListItem2.get_item(‘Title’);




function onQueryFailed(sender, args) {

    alert(‘Request failed. ‘ + args.get_message() + ‘n’ + args.get_stackTrace());


Testing the Code

Save and Refresh the page. You can see that the items from both lists are fetched.



You can see that the above message boxes shows items from 2 different lists. The code completed in one roundtrip instead of two.


REST is Chattier, but JSOM allows Batching.



In this article we have explored a JSOM batching example.

Posted in SharePoint, SharePoint 2013 | Tagged: , , , , | Leave a Comment »

SharePoint Non-Functional Requirements

Posted by Jean Paul on November 5, 2015

In this article we can explore the typical Non-Functional Requirements in the SharePoint world.

You can download the template here.


Non-Functional Requirements

Non-Functional Requirements are additional to the Functional Requirements. Non-functional Requirements aka NFR contains the operational aspects of the application rather than the behavioral ones. Depending on your organization & processes:

· There can be separate documents for Functional & Non-Functional requirements

· Or, It can be the same document


Non-Functional Parameters

Following are the important Non-Functional Parameters:

1. Users

2. Capacity

3. Performance

4. Sensitivity

5. Scalability

6. User Interface

7. Availability

8. Recoverability

9. Security

10. Interoperability

Let us see each category questions in the following table. In the real-worlds scenario these questions need to be answered by the business team.

NFR Table





Total Number of Users


Total Number of Concurrent Users


User Locations

US, UK, Singapore

Peak Hours / Period



Response Time for Home Pages

3 seconds

Response Time for Operational Pages

5 seconds

Response Time for Reporting Pages

10 seconds


Average Size of Documents

300 KB

Total Size of Database on Day-1

1 GB (SP have 200 GB limit)

Total Size of Database after Year-1

2 GB

Maximum Number of List items

2000 (SP have limit of 5000)


Sensitive Data Involved

If Yes, On-Premise deployment would be preferred so that data would not go outside.

Legal, Privacy, Copyrighted components/data involved


Expected Growth % in Users per Year


Expected Growth % in Database Size per Year


User Interface

Languages Supported

English Only

Devices Accessed

Mobile, Tablet, Desktop

Responsive Design Required

Corporate Branding Required


Supported Browsers

IE 11, Chrome

Supported Operating Systems

Windows 7, 8, Android


User Roles – Activities

Administrators – Manager Users

Contributors – Create Content

Approvers – Approve / Reject

Viewers – Read Content


Depending Applications

Read/Write by HR

Dependent Applications

Read/Write from Sales


Availability %



Restoration Period

12 hours


You may need to cross-check the NFR with SharePoint Boundary Limitations given in References.

For example:

· The recommended max-size for site collection is 200 GB

· The default max-number of list items is 5000



In this article we have explored the typical Non-Functional Requirements for a SharePoint project. The template document is attached with this article.

Posted in SharePoint, SharePoint 2013 | Tagged: , | Leave a Comment »