Saturday, November 30, 2013

How to: Convert an HTML file into a master page in SharePoint 2013?

How to: Convert an HTML file into a master page in SharePoint 2013?
This seems to be easier way to convert  design html file to master page.
 I think , this is introduced to integrate html elements like header, footer, main contents into respective SharePoint elements like different content placeholder ids , SharePoint controls etc  in html file itself , so that this file is editable in any Non-SharePoint html editors . This is great. but for beginners this may be a little tricky.
I would suggest , rather than converting entire html file into master page , one should  start with startermaster.html.
To do so
1)Download startermaster.html from Master Page gallery.Open startermaster.html in browser and inspect header and footer elements in Developer tools
2)Now copy html elements like topnavigation div , logo div , search div etc from original html  file to
  startermaster.html (also rename this file to suitable name) at appropriate place.
3) This startermaster.html  is now ready for converting to master page .In this way , the html validation errors also can be avoided .Now embed SharePoint snippets at appropriate place.

Thursday, October 31, 2013

SharePoint hosted app to enable Geolocation column

GeoLocation field is newly introduced column type in SharePoint 2013 .You will not see any field of type GeoLocation by  by default but It needs to be enabled with program. This is quite useful to
save the Geographic info in SharePoint List.

1)Create a SharePoint hosted app and open up the Start page , here before executing actual CSOM
   following  few lines , get the context of hostweb url , app Web url and loads the sp.js

<script type="text/javascript">
    var hostweburl;
 var appweburl;
var web;
var list;
var context;
    // Load the required SharePoint libraries.
    $(document).ready(function () {

        // Get the URI decoded URLs.
        hostweburl =
  appweburl =

        // The js files are in a URL in the form:
        // web_url/_layouts/15/resource_file
        var scriptbase = hostweburl + "/_layouts/15/";

        // Load the js files and continue to
        // the execOperation function.
        $.getScript(scriptbase + "SP.Runtime.js",
            function () {
                $.getScript(scriptbase + "SP.js", execOperation);

2)Now with the help of CSOM ,create SP list with GeoLocation column added to it.

   // Function to execute basic operations.
    function execOperation() {

    //context = new SP.ClientContext(hostweburl);
 context = new SP.ClientContext(appweburl); 
 var appContextSite = new SP.AppContextSite(context, hostweburl);
   // this.web=context.get_web();
   this.web= appContextSite.get_web();   
     // Continue your program flow here.

var listCreationInfo = new SP.ListCreationInformation();

this.list = this.web.get_lists().getByTitle('CustomList');

var fldCollection = this.list.get_fields();

var geoField = context.castTo(
fldCollection.addFieldAsXml('<Field Type="Geolocation" DisplayName="GeoLocation" Name="GeoLocation" />',
geoField.set_title("Geo Location");



function genericSuccess(sender, args) {
function genericFail(sender, args) {
    alert('Request failed. ' + args.get_message() + 
        '\n' + args.get_stackTrace());

    // Function to retrieve a query string value.
    // For production purposes you may want to use
    // a library to handle the query string.
    function getQueryStringParameter(paramToRetrieve) {
        var params =
        var strParams = "";
        for (var i = 0; i < params.length; i = i + 1) {
            var singleParam = params[i].split("=");
            if (singleParam[0] == paramToRetrieve)
                return singleParam[1];

3)Once this app is deployed successfully then you will see , List with name Custom List with  Geolocation locumn added to it in host site

Wednesday, September 18, 2013

Most Valuable SharePoint Community

Diagnosing Display Template : Classical Overview Of Configuring Item Templates for Search WebParts

 To know more about what is Control Display Template and Item Display Template , Read this post.
 To diagnose  query values in Display template (In search webparts) , Item_Diagnostic item template is  available OOB. 
 To Configure this Item Template in Search Results WebPart's Toolpane,proceed as follows

 1)Navigate to Master Page gallery-->Display Templates-->Content Webparts -->Item_Diagnostic.html
    and Edit the properties to to check Search Result Webpart as Target control Type

 2)Now Edit the Search Page and Search Result WebPart to Select this Item template

 3)I found that in office 365 site this gives following error,but this can be corrected.
    To do so,Download Item_Diagnostic.html,Open with editor 
    search for this code line
    var pictureMarkup = Srch.ContentBySearch.getPictureMarkup(pictureURL, 100, 100, ctx.CurrentItem,    "cbs- picture3LinesImg", line1, pictureId);
and replace it by 
 var pictureMarkup =' ';
 Now rename the file , and upload it in display templates folder and set Target Control Type as Search Result

Display Error: The display template had an error. You can correct it
 by fixing the template or by changing the display template used in either the 
Web Part properties or Result Types.

Cannot call method 'getPictureMarkup' of 
undefined (CoreRender: ~sitecollection/_catalogs/masterpage/Display Templates
/Content Web Parts/Item_Diagnostic.js)
But  this should work in SharePoint 2013
anyways this post is to provide classical overview of Configuring Item Template for Search WebParts
All Item Template for Refinement Search WebPart will be found in Filter folder Under Display Templates folder in MasterPage gallery

Monday, September 9, 2013

Composed Look In SharePoint 2013: Templatization Of Look and Feel

I think idea behind introducing  Composed Look  is ,
a)Preparing look and feel in form of template
b)Modifying the look and feel on the fly.
1)Take a look at following Image, which helps to change the background image of the Master Page, on the fly.

2)Once Composed look is created , Under Site settings -->Look and feel -->Change the Look -->Select recently created look and apply . Here is my site with change of background Image :)
 For more insight about .spcolor and .spfont files , see this post and this one

Thursday, September 5, 2013

Display Templates Bit By Bit

In SharePoint 2013 and Office 365, Content search Webpart and Search result Webpart respectively ,can be use to get the aggregated Contents based on conditions
Display Templates consists of 2 Templates
1) Control template
   a)  To show multiple groups Group template can be configured.
   b)  To show contents without groups Content Template can be configured directly
2)Item Template
Above contents are based on my understanding. If you want to modify this post please write into comments

Sunday, August 25, 2013

Security Trimming for Managed Navigation in SharePoint 2013

Managed Navigation is the new concept which is introduced in SP 2013. Manged terms can be used for Navigating to Pages but it has  few limitations .
one of the limitation is, there is no OOB way to apply security trimming. But Interestingly I found one :)
So , try as follows
1)In Pages Library, Edit Page property to update the Managed metadata column ( Wiki Category can be used  for the same purpose

2)Once the Page is tagged with specific Metadata , Open  up the  Hidden Taxonomy List and break the permission for this List (here you have to make sure that , the Page and Managed Term has same unique permissions)
So Navigate to siteurl/Lists/TaxonomyHiddenList/AllItems.aspx  and find  for the metadata term , for which the page was tagged for
3)Hit 'Shared With' --> 'Advanced Setting'  and provide unique permission to this term , so that this term will be visible to only particular group or user.

Friday, August 9, 2013

An OOB Webpart Customization Approach:Client Side Rendering Of List / WebParts using JSLink in SharePoint 2013

I read many articles regarding use of JSLink and this one for MDS enabled sites. But I would like to explain it at high level
Unlike in SharePoint 2010 OOB list customization/WebPart customization ,Now there is no need to override OOB css or writing javascript logic considering whole html rendered at runtime.
Using JSlink , OOB html can be replaced at elementary level as follows.

(function () {
    // Initialize the variable that stores the objects.
    var overrideCtx = {};
    overrideCtx.Templates = {};

   1) // Here customize list header by replacing header html
    overrideCtx.Templates.Header = "<B><#=ctx.ListTitle#></B>" +
        "<hr><ul id='unorderedlist'>";

   2) // Here this function will be called  n number of times where n is the numb         er of items in list or library

    overrideCtx.Templates.Item = customItem;

    3) // Here customize list footer by replacing footerhtml

    overrideCtx.Templates.Footer = "</ul>";

    // Register the template overrides.

// This function builds the output for the item template.
// It uses the context object to access announcement data.
function customItem(ctx) {

    // Build a listitem entry for every listitem in the list.
    var ret = "<li>" + ctx.CurrentItem.Title + "</li>";
    return ret;

This resolves problem about writing XSLT at listview/Dataview level.But in Content query webpart , still there is space for writing xslt but that's why Content search webpart is introduced . though it is available in on-premise version, try this link for it's replacement in office 365

Monday, August 5, 2013

Data Access in SharePoint And Remote App :Inbound and Outbound scenarios

1)Data Access in SharePoint And Remote App :Inbound scenarios

Inbound data connectivity

The following connectivity options are available for inbound scenarios:
  • OAuth: An open protocol that enables secure authorization in a simple and standard way.
    AppOnly Policy : enables users to approve an application to act on their behalf without sharing their user name and password.                                                                                                         
    Server Side Code :You can use OAuth with server-side code. It is a good option if you need to run a non-interactive process, or if you need to elevate privileges to other than those of the logged-on user. For information about OAuth, see Authorization and authentication for apps in SharePoint 2013.
  • Cross-domain library: A client-side alternative in the form of a JavaScript file (SP.RequestExecutor.js) hosted in the SharePoint website that you can reference in your remote app as long as they are in the same internet zone. Multi-domain Interaction : The cross-domain library allows you to interact with more than one domain in your remote app page through a proxy.                                                                        
    Client Side Code : This is a good option if you prefer your app code to run in the client rather than in the server, or if there are connectivity barriers, such as firewalls, between SharePoint and your remote infrastructure. For more information, see How to: Access SharePoint 2013 data from remote apps using the cross-domain library.
    (Click following image )

2)Data Access in SharePoint And Remote App :Outbound scenarios

Outbound data connectivity

The following connectivity options are available for outbound scenarios (see Figure 2):
  • Web proxy: As a developer, you can use the web proxy exposed in client APIs such as the JavaScript/.NET client object models. When you use the web proxy, you issue the initial request to SharePoint. In turn, SharePoint requests the data to the specified endpoint and forwards the response back to your page. Use the web proxy when you want the communication to occur at the server level
    Both Javascript/.Net CSOM is available.                                                                               
    Direct calls through browser are not supported.
    For more information, see How to: Query a remote service using the web proxy in SharePoint 2013.
  • Remote event receivers: You can use remote event receivers to handle events that occur to an item in the app, such as a list, a list item, or a web. These events resemble those in a traditional SharePoint solution, except that they can work with the remote components of the app for SharePoint.
    Only .Net CSOM is available.    
    Client Side Technologies are not supported .                                                                 
    App can not access resource as current logged in User .
     For more information, seeHandling events in apps for SharePoint.
  •  Custom proxy page for the cross-domain library: You can use the cross-domain library to access data in your remote app if you provide a custom proxy page that is hosted in the remote app infrastructure. As the developer, you are responsible for the custom proxy page implementation and must deal custom logic, such as the authentication mechanism, to the remote app. Use the cross-domain library with a custom proxy page if you want the communication to occur at the client level. 
    Can not add SharePoint Components to Remote App                                                         
    .Net CSOM is not available
    (Click following image )

Sunday, August 4, 2013

What is Distributed Cache Service in SharePoint 2013 ?How does it help in authentication?

One of the big changes for the authentication infrastructure is being able to use the new Distributed Cache Service.  SharePoint uses that caching service to keep track of FedAuth  cookies for users that authenticate using FBA or SAML authentication.  In SharePoint 2010 each web front end kept their own local cache of fed auth cookies, and as a result we required you to use sticky sessions with your load  balancers to ensure that once a user got
authenticated, he or she was always redirected back to the same server so the 
authentication cookie could be found.  By using the new Distributed Cache to keep track of 
these authentication cookies, we no longer require sticky sessions when you use FBA or
SAML claims in SharePoint 2013.

 A) FBA authentication

Forms-based claims authentication is an interaction between a client computer, a SharePoint server, and a membership and role provider that is available through the ASP.NET interface.

Step 1: Assuming that the client computer does not already have a claims-based security token, forms-based claims authentication occurs when it makes an initial anonymous request of a secured SharePoint web page.
Step 2: The SharePoint server responds with a forms-based login page for the user to enter credentials.
Step 3: The user on the client computer types credentials and the client computer sends them.
Step 4: The SharePoint server then validates the sent credentials with the configured membership provider.
Step 5: The SharePoint server then queries the role provider for the roles associated with the user credentials. These become the list of role claims for the user account.
Step 6: The Security Token Service on the SharePoint server then creates a claims-based security token and stores it with the Distributed Cache service on the SharePoint farm. Claims in the security token are based on the user name and the list of roles for the user account.
The SharePoint server then creates and sends a Federated Authentication, or FedAuth, cookie to the client computer. This cookie contains an encrypted key or index to the security token. If the user is authorized to access the requested web page, through analysis of the claims in the security token and the configured permissions, the SharePoint server then sends the contents of the page. For subsequent requests, the client computer uses the FedAuth cookie for authentication.

B)SAML Based (ADFS)  claims authentication

SAML-based claims authentication is an interaction between a client computer, a SharePoint server, an identity federation server (such as Active Directory Federation Services, or AD FS), and an identity provider, which contains the actual accounts, passwords, and account attributes, such as Active Directory Domain Services, or AD DS.
Please note that this process example is deliberately simplified. AD FS and SAML claims are not required if you are using an AD DS infrastructure in which the forests and domains trust each other.
Before we step through the authentication process, let’s examine the set of trust relationships that must be in place. First, the federation server, the AD FS server, must trust the identity provider for which it is issuing SAML security tokens. In this case, the trust is implicit because the AD FS server is a member of the AD DS domain, and therefore trusts the validation of security credentials by its domain controllers.
AD FS must also trust security token requests for locations on the SharePoint server.
For this trust relationship, you configure AD FS with the URLs of SharePoint web applications as relying parties. Web pages within those URLs will now be trusted for SAML security token requests.
The SharePoint server must also trust the AD FS server. The AD FS server uses a signing certificate to sign the SAML security tokens that it issues. To validate the digital signature on the security tokens issued by AD FS, you configure the SharePoint farm with the public portion of that signing certificate.
Now let’s take a look at the authentication process.
  • Step 1: Assuming that the client computer does not already have a claims-based security token, SAML-based claims authentication occurs when it makes an initial anonymous request of a secured SharePoint web page.
  • Step 2: The SharePoint server redirects the client computer to the AD FS server to obtain a SAML-based login page for user credentials.
  • Step 3: The user types credentials and the client computer sends them to the AD FS server with a request for a SAML security token.
  • Step 4: The AD FS server validates the sent credentials with the identity provider, which in this case is an AD DS domain controller.
  • Step 5: The AD FS server constructs a SAML security token, signs it, and then sends it to the client computer.
  • Step 6: The client computer sends a new request for the web page, this time it includes the SAML security token that it received from the AD FS server.
  • Step 7: The Security Token Service on the SharePoint server then creates a claims-based security token and stores it with the Distributed Cache service on the SharePoint farm. Claims in this security token are based on the claims in the SAML security token from the AD FS server.
The SharePoint server then creates and sends a Federated Authentication, or FedAuth, cookie to the client computer. This cookie contains an encrypted key or index to the security token. If the user is authorized to access the requested web page, through analysis of the claims in the security token and the configured permissions, the SharePoint server then sends the contents of the page. For subsequent requests, the client computer uses the FedAuth cookie for authentication.

Thursday, August 1, 2013

Building Custom Service Applications But When?

1)Whenever there is requirement to share the data across cross sitecollections or across farms
 or if you want to associate third party service may be for analytics or computation. building custom service application is must
2)To do so, you need to develop Webfront end server (Proxy UI for configuration), Application server (WCF end point) and SQL databases
Checkout this to get standard template to build custom service application

Saturday, July 6, 2013

SharePoint 2013 Search WebParts and Display Template

SharePoint 2013 Search Webparts, are configured with Display Templates unlike previous versions of SharePoint . This  is quite useful as Search customization become easy with editing just snippet of htmls and JS  rather than complex XSLT transformations.Take a look at Display Templates  reference
 and this one to know about how Display Template are structured

To know about how each Display Template  associated with  each Search Webpart,
In Site Settings Menu --> Select Design Manager-->Edit Display Template and Filter by  search Webpart as shown in following image.
and then filter with  Filter Content Type,Here you can decide ,how to customize different search webpart associated with different Display Template

Now if you want to upload Customized Display Template, Upload it in Master Page gallery-->Display Template-->Search

Lets  take an example of Refiner WebPart. If you edit this WebPart in Search Page ,you will  find every managed property( of type string/Int/Date/Bool is associated with Display Template.
If Managed Property is of Type Int or DateTime, you can customize Refiner Webpart to refine it by Slider Template with Bar Graph. (but Note, unless managed property has values  , nothing will be shown up)

Once you save changes, awesome  slider refiner will appear in Refiner WebPart
For  Custom managed properties take a look at this awesome post 

Sunday, June 30, 2013

How to enable BCS Model With ADO.NET Entity Framework?

In SharePoint 2013, You will know how Odata Protocol is important to create RESTful services.
and with the help of ADO.net entity framwork associated with WCF , RESTful services can be enabled.
It is always good practice to enable Custom BCS model with ADO.NET Entity Framework.
I am highlighting key points at High Level  (later on I will elaborate it more..but still you can google out :))

1)Create BCS Model with Visual Studio 2010/2012

2)In Same solution , Add ADO.Net Entity Model  (In Add New Item-->Data tab)

3)Create Methods like ReadItem ,ReadList,Create,Update,Delete Methods by Implementing it in Code behind class for BCS

4)Map these methods to  adjust return types and input parameters and Properties  ,as per the object  described in ADO.Net Entity designer class
Define the identifier column and update it in BCS

5)Remove the class , which is created by default for BCS Model  for defining properties like identifier and Message

6)Now Deploy BCS Model and Set appropriate Permissions in Central Admin

7)Once you create the External List from this external Content Type ( formed after Deploying this model),
   You have to resolve following issue
   i)Unable to Display WebPart .... Edit with SharePoint Designer etc .. etc..
     Solution : Set Throttling limit for BDC service

Get-SPBusinessDataCatalogThrottleConfig -Scope Database -ThrottleType Items -Ser
viceApplicationProxy your bdc service id | Set-SPBusinessDataCa
talogThrottleConfig -Maximum 8000 -Default 6000

ii)Check few more issues that you may come across  

Tuesday, June 11, 2013

SharePoint 2013 Search :Query Rules Explained

To  promote specific search result ,or for efficient search, relative to user context , query rules are introduced  in SharePoint 2013.
These rules are executed , for particular search terms entered by the site user.
Say  for example, if search result should reflect recently updated site  conversations, you need to define query rule as follows.
1)These rules can be defined at 3 different scopes
For on-premise version, query rules can be defined at farm scope  and for  both the versions(Online version and On Premise version) query rule rules can be defined at tenant (site) and multi-tenant  levels (site collection).

2)Under Site settings-->Search-->Query Rules ,see all the predefined rules by selecting  All Sources (in dropdown) as shown in Image.

3)Identify the predefined query rules ( provided by the SharePoint) which may be close to your requirement.
 and Make the copy of existing one
For this example ,to promote search result for recently added conversations copy predefined query rule for conversion 

4)Edit newly copied query rule  to add the result block for recently updated conversations as follows

  5)Click add result block and Launch query builder to form the search query

6)To know more about the other customization options ,read this and this nice blog post

Friday, June 7, 2013

How To Enable Site Web Analytics Reports For SharePoint Online?

In On-Premise version of SharePoint 2013 , Web Analytics feature can be enabled  in central admin site.
And then if you browse to the path  ~/_layouts/usagedetails.aspx path, you will get the usage data ,
but for the SharePoint online , it is different Story
This feature needs to be added as app

SharePoint Content Targeting With Audience Rules

SharePoint contents can be targeted to dynamic set of audience (SPUsers) satisfying  the Audience Rule
and matching particular user profile property or combination of multiple SharePoint groups or distribution lists

1)To do so, Under user profiles (In Central admin) --> select  Manage Audience

2)Create new audience and apply audience rules like follows and compile this audience group

Note--> You need to enable audience targeting for lists or libraries in settings page
3)Now whenever , New app part or webpart is added to the page ,(In Edit mode)In Edit toolpane, you can set custom Audience , irrespective of particular SharePoint Group

Tuesday, May 28, 2013

How to Monitor and Track Error Logs for SharePoint Apps?

Apart from developing app, it is equally important to  track the usages of SharePoint apps
To do so, step through as follow
1)In Ribbon--> Admin-->SharePoint--> select Apps tab (in Left )--> Apps catalog

2)Upload the tested App in this document library (Apps for SharePoint)

when you upload app here it is available to all the tenants associated with it

3)Now go back to Apps setting Page , and click Monitor Apps Link

4)Now select the App to Monitor,and see the analytic about the App.


Sunday, May 19, 2013

Developing Search App to Query by Result Sources using Search REST

I hope many people know about Result Source in SharePoint 2013 by now (if not Please  google out :))
Now Result sources can be queried using Search Rest Api
Following code snippet show how to do that
1)Along with query parameter you need to know guid for Result Source
To get this GUID , browse to this link _layouts/15/manageresultsources.aspx?level=site

2) Edit the required Result Source, and in browser  ,guid can be obtained from url similar to this url
3)Add New Napa Project and add  replace app.js with this code snippet

$(document).ready(function () {
    var e = ExecuteOrDelayUntilScriptLoaded(showToolbar, "sp.js");

function showToolbar() {

function executeQuery(queryTerms) {

    Results = {
        element: '',
        url: '',

        init: function (element) {
            Results.element = element;
            Results.url = _spPageContextInfo.webAbsoluteUrl + "/_api/search/query?querytext='" + queryTerms + "'&sourceid='48fec42e-4a92-48ce-8363-c2703a40e67d'";

        load: function () {
                        url: Results.url,
                        method: "GET",
                        headers: {
                            "accept": "application/json;odata=verbose",
                        success: Results.onSuccess,
                        error: Results.onError

        onSuccess: function (data) {
            var results = data.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results;
            var html = "<table>";

            for (var i = 0; i < results.length; i++) {
                html += "<tr><td>";
                html += results[i].Cells.results[0].Value;
                html += "</td><td>"
                html += results[i].Cells.results[1].Value;
                html += "</td></tr>";
     html += "<tr><td>";
                html += results[i].Cells.results[2].Value;
                html += "</td><td>"
                html += results[i].Cells.results[3].Value;
                html += "</td></tr>";
     html += "<tr><td>";
                html += results[i].Cells.results[4].Value;
                html += "</td><td>"
                html += results[i].Cells.results[5].Value;
                html += "</td></tr>";
     html += "<tr><td>";
                html += results[i].Cells.results[6].Value;
                html += "</td><td>"
                html += results[i].Cells.results[7].Value;
                html += "</td></tr>";

            html += "</table>";

        onError: function (err) {



4) and Replace Default.aspx as follows

<%-- The following 4 lines are ASP.NET directives needed when using SharePoint components --%>
<%@ Page Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" MasterPageFile="~masterurl/default.master" Language="C#" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%-- The markup and script in the following Content element will be placed in the <head> of the page --%>
<asp:Content ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
 <script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js"></script>
 <script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
 <script type="text/javascript" src="/_layouts/15/sp.js"></script>

 <!-- Add your CSS styles to the following file -->
 <link rel="Stylesheet" type="text/css" href="../Content/App.css" />

 <!-- Add your JavaScript to the following file -->
 <script type="text/javascript" src="../Scripts/App.js"></script>

<%-- The markup in the following Content element will be placed in the TitleArea of the page --%>
<asp:Content ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server">
 Page Title

<%-- The markup and script in the following Content element will be placed in the <body> of the page --%>
<asp:Content ContentPlaceHolderID="PlaceHolderMain" runat="server">

  <div id="toolbarDiv" style="display: none">
        <input type="text" style="width: 200px" id="queryTerms" />
        <input type="button" value="Search" onclick="executeQuery($get('queryTerms').value);" />
    <div id="resultsDiv"></div>


5)And Apply Search Permissions as Read In Settings-->Permissions tab of Project 

To  Know more about search end point visit this post

Developing A Social SharePoint Hosted App With Social REST

Once you know about the end points associated with Social data, Developing Social Apps become too easy.
Following example shows , how to get the feed activity of the current user  and by the people and content user is following
To create this App, Open up new Project in Napa and click App.js
 and add the following snippet

'use strict';

var context = SP.ClientContext.get_current();
var feedManagerEndpoint;

// Get the SPAppWebUrl parameter from the query string and build
// the feed manager endpoint.
$(document).ready(function () {
    var appweburl;
    var params = document.URL.split("?")[1].split("&");
    for (var i = 0; i < params.length; i = i + 1) {
        var param = params[i].split("=");
        if (param[0] === "SPAppWebUrl") appweburl = param[1];
    feedManagerEndpoint = decodeURIComponent(appweburl)+ "/_api/social.feed";

// Publish a post to the current user's feed by using the 
// "<app web URL>/_api/social.feed/my/Feed/Post" endpoint.
function postToMyFeed() {
    $.ajax( {
        url: feedManagerEndpoint + "/my/Feed/Post",
        type: "POST",
        data: JSON.stringify( { 
                'ContentText':'This post was published using REST.',
        headers: { 
            "accept": "application/json;odata=verbose",
            "X-RequestDigest": $("#__REQUESTDIGEST").val()
        success: getMyFeed,
        error: function (xhr, ajaxOptions, thrownError) { 
            alert("POST error:\n" + xhr.status + "\n" + thrownError);

// Get the current user's feed by using the 
// "<app web URL>/_api/social.feed/my/Feed" endpoint.
function getMyFeed() {
    $.ajax( {
        url: feedManagerEndpoint + "/my/news",
        headers: { 
            "accept": "application/json;odata=verbose"
        success: feedRetrieved,
        error: function (xhr, ajaxOptions, thrownError) { 
            alert("GET error:\n" + xhr.status + "\n" + thrownError);

// Parse the JSON data and iterate through the feed.
function feedRetrieved(data) {
    var stringData = JSON.stringify(data);
    var jsonObject = JSON.parse(stringData); 
    var feed = jsonObject.d.SocialFeed.Threads; 
    var threads = feed.results;
    var feedContent = "";
    for (var i = 0; i < threads.length; i++) {
        var thread = threads[i];
        var participants = thread.Actors;
        var owner = participants.results[thread.OwnerIndex].Name;
        feedContent += '<p>' + owner + 
            ' said "' + thread.RootPost.Text + '"</p>';

Also  to get the feeds for particular user, REST Url can be queried as follows.


Read more about working with Social Feeds

Make sure that following permissions are granted to SharePoint App

This is very helpful REST API (End Point) reference for Social Data
And  Tutorial for using Social REST API for following contents (Requires office 365 developer site)