Category Archives: SharePoint 2013

SharePoint 2013

Newsfeed Insights

SharePoint Newsfeed Insights

Newsfeed InsightsOne of my clients who is using SharePoint 2013 Sitefeeds extensively in his new social intranet asked me to build ‘something’ to get some insights out of the Social feeds.
So I went and build a little demonstration just to get the following insights out of a SharePoint Site Newsfeed.

  • total number of posts
  • total number of replies
  • total number of likes

I wrote the following peace of JavaScript code to get to the JSON response of a Newsfeed. From there it is just a matter of digging through the structure of the data object.

<html>
  <head>
    <meta charset="utf-8">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js" />
    <script>
      var siteUrl = _spPageContextInfo.webAbsoluteUrl;
      var url = "/_api/social.feed/actor(item=@v)/feed(MaxThreadCount=10000)?@v='" + siteUrl + "/newsfeed.aspx'"

      $.ajax({
        url: url,
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        dataType: 'json',
        success: function (data) {}, 
        error: function (data) {}
      });
    </script>
  </head>
  <body> 
  </body>
</html>

Here are a couple of examples on what to find were in the JSON Response

Total number of posts
data.d.SocialFeed.Threads.results.length

number of replies of a single post
data.d.SocialFeed.Threads.results[0].TotalReplyCount

number of likes of a single post
data.d.SocialFeed.Threads.results[0].RootPost.LikerInfo.TotalCount

number of likes of a single reply of a post
data.d.SocialFeed.Threads.results[0].Replies.results[0].LikerInfo.TotalCount

Here is the complete JavaScript code of my demo. You can use it in SharePoint WebParts, Add-Ins, Apps, or just put the js file in the Site Assets library and use it in a CEWP (Content Editor Web Part)

<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"/ >
<script>
 var siteUrl = _spPageContextInfo.webAbsoluteUrl;
 var url = "/_api/social.feed/actor(item=@v)/feed(MaxThreadCount=10000)?@v='" + siteUrl + "/newsfeed.aspx'"
 $.ajax({
   url: url,
   method: "GET",
   headers: { "Accept": "application/json; odata=verbose" },
   dataType: 'json',
   success: function (data) {
     if (data.d.SocialFeed.Threads != null) {
       var results = data.d.SocialFeed.Threads.results;
       var numberOfPosts = 0, numberOfReplys = 0, numberOfLikes = 0;
       numberOfPosts = results.length;
       for(var i = 0; i < numberOfPosts; i++) {
         numberOfReplys = numberOfReplys + results[i].TotalReplyCount;
         numberOfLikes = numberOfLikes + results[i].RootPost.LikerInfo.TotalCount;	
         for(var j = 0; j < results[i].Replies.results.length; j++) {
           numberOfLikes = numberOfLikes + results[i].Replies.results[j].LikerInfo.TotalCount;	
         }					
       }

       document.querySelector("#socialThreadStats .sts-posts").innerHTML = numberOfPosts;
       document.querySelector("#socialThreadStats .sts-replys").innerHTML = numberOfReplys;
       document.querySelector("#socialThreadStats .sts-likes").innerHTML = numberOfLikes;
     }
 	else {
 	   document.getElementById("socialThreadStatsStatus").innerHTML = "No Newsfeed found in this web please check configuration"
 	}  
   }, 
   error: function (data) {}
 });
</script>
<style>
  #socialThreadStats {
    display: table;
    padding-top:20px;    
  }
  #socialThreadStats ul {
    display: table-row;
    height: 50px;
    vertical-align: bottom;
  }
  .sts-stat-header {
    display: table-cell;
    width: 120px;
    height: 50px;
    font-size: 16px;
    border-bottom: 2px solid lightgrey;
  }
  .sts-stat-value {
    display: table-cell;
    width: 106px;
    height: 50px;
    font-size: 36px;
    text-align: center;
    border-bottom: 2px solid lightgrey;
  }
</style>
</head>
<body>
  <h1>What´s happening</h1>
  <div id="socialThreadStats">
    <ul>
      <li class="sts-stat-header"><span class="sts-posts-Text">Posts: </span></li>
      <li class="sts-stat-value"><span class="sts-posts"></span></li>
    </ul>
    <ul>
      <li class="sts-stat-header"><span class="sts-replys-Text">Replies: </span></li>
      <li class="sts-stat-value"><span class="sts-replys"></span></li>
    </ul>
    <ul>
      <li class="sts-stat-header"><span class="sts-likes-Text">Likes: </span></li>
      <li class="sts-stat-value"><span class="sts-likes"></span></li>
    </ul>
  </div>
  <div id="socialThreadStatsStatus"></div>
  </body>
</html>

There is also a really good MSDN documentation on social feeds in SharePoint I want to share with you. https://msdn.microsoft.com/en-us/library/office/dn155789.aspx

UPDATE:

I updated the script to be able to get more than the default 20 threads.
You can use the ‘MaxThreadCount’ Property of the feed to get more threads. I set it in the example to feed(MaxThreadCount=10000) to get up to 10000 threads back. A thread is a post in the newsfeed. This does not count for Replies.

SharePoint – Providing operations on Azure?

Introduction

A recent question attracted our interest:
Can we utilize Microsoft® Azure and extend our service portfolio to provide operations?

Before answering this question, let me introduce the problem.
As a successful solution provider for Microsoft® SharePoint and SharePoint based applications, we neglected operations. Mainly, because we cannot – could not – provide the necessary hardware and Service-Level-Agreements (SLA), and secondly, because we were never asked to provide such measures. Furthermore, cloud-based solutions were not available especially because Microsoft® explicitly did not support cloud-based SharePoint farms. Until now.

Today things are changing rapidly – and customers usually do not apply the brakes to their business. This is when we were asked if we could provide SharePoint as a hosted or managed service. And it’s exactly when we started to analyse the capabilities of Microsoft Azure as related to our customer’s needs:

Technical service scenarios

We examined four possible service scenarios:

  1. Hosted SharePoint
    Azure provides Infrastructure as a Service (IaaS), the service provider deploys and maintains Active Directory (AD) and SharePoint VMs and customers use “SharePoint as a Service”.
    Customers have no administrative rights on the VMs and have defined access rights to SharePoint.
  2. Managed
    Azure provides IaaS, we deploy and maintain AD and SharePoint VMs as stipulated by contract, customers maintain and use the system.
    Customers have defined administrative access rights to the SharePoint farm.
  3. Dedicated
    Azure provides IaaS, we set up AD and SharePoint VMs as stipulated by contract, customers maintains and use the system – or delegate maintenance the service provider. Further services are provided as agreed.
    Customers have full administrative rights.
  4. Testbed
    Azure provides IaaS, service provider sets up AD and SharePoint VMs, depending on customer’s testing requirements

Figure 1 illustrates the mentioned service scenarios, showing the level of responsibility and influence of the participating parties, with Microsoft always being responsible for Azure itself.

Responsibilities by service scenario on Azure

Figure 1 – Responsibilities by service scenario on Azure

Despite these scenarios three more use-cases should be considered:

  • Azure enables service providers to scale a SharePoint farm instantly, depending on current load and/or needs – without charging customers unnecessarily during calm phases
  • It is now reasonable to operate a second backup-farm for failover purpose
    e.g. a local disaster or outage can be rescued by a cloud-mirrored SharePoint
  • With full Hyper-V-compatibility provided by Azure, a customer can easily move his virtual machines over to Azure

Advantages and possibilities for customer’s business

In the past, both cases required a higher need of greatly expensive resources (hardware, software, housings, infrastructure, energy, maintenance, etc.). Today, with cloud-based IaaS, business can concentrate on its main priorities by turning capital expenditure into scalable running expenses. This results in effective productivity and flexibility.

Let’s focus on the opportunities for your business, divided into the service scenarios:

A hosted SharePoint farm/service offers the highest ROI for a customer’s business and let’s focus on a company’s core business. It is not mandatory to invest in hardware and care about operations. The service provider will deliver a worriless SharePoint experience. That’s why hosted SharePoint is a value for small business, too. But if customers are looking for a higher grade of flexibility…

Flexibility is more in focus on a managed SharePoint farm and offers the technical personnel larger freedom in supporting their company’s business workflows. Without any need of high investments, though.

Does an enterprise want or need a steady hand on the tiller? Then a dedicated SharePoint solution is the goal: The IT department keeps full control, with the necessary support and configuration, provided by us.

Even if a customer just needs a safe and isolated testbed for update evaluation, backup-and-restore-tests, or the like, Azure can serve as you well!

What all of these solutions have in common is to seamlessly connect to an enterprise on premise network via secured VPN. Furthermore the cloud-based farm can be synchronized with the on premise Active Directory and SharePoint farm.

Finally we conclude: Yes, Azure has the potential to extend our portfolio in a way that allows you to focus on your customer’s business, and thereby enabling us to provide you with the best chance in concentrating on your business!

Finally, one thing is for sure: If you are in need of a competent SharePoint solution provider – feel free to contact us!

Color palettes and fonts in SharePoint 2013

Today I want to talk just a little bit about designs in SharePoint 2013. You should know that I am not one of the greatest Web Designers and I believe I was never meant to be one of them. But Microsoft made it very easy to get your own corporate look and feel in SharePoint 2013 by just adjusting the color palettes and fonts. It’s not a full-blown design but its maybe just right for some of you.

But still it was just a bunch of hexadecimal color codes in an XML formatted file which looks like the following.

<?xml version="1.0" encoding="utf-8"?>
<s:colorPalette isInverted="false" previewSlot1="BackgroundOverlay" previewSlot2="BodyText" previewSlot3="AccentText" xmlns:s="http://schemas.microsoft.com/sharepoint/">
    <s:color name="BodyText" value="444444" />
    <s:color name="SubtleBodyText" value="777777" />
    <s:color name="StrongBodyText" value="262626" />
    <s:color name="DisabledText" value="B1B1B1" />
    <s:color name="SiteTitle" value="262626" />
    <s:color name="WebPartHeading" value="444444" />
    <s:color name="ErrorText" value="BF0000" />
    <s:color name="AccentText" value="FF0000" />
    <s:color name="SearchURL" value="338200" />
    <s:color name="Hyperlink" value="0072C6" />
    <s:color name="Hyperlinkfollowed" value="663399" />
    <s:color name="HyperlinkActive" value="9B0000" />
    <s:color name="CommandLinks" value="666666" />
    <s:color name="CommandLinksSecondary" value="262626" />
    <s:color name="CommandLinksHover" value="FF0000" />
    <s:color name="CommandLinksPressed" value="9B0000" />
    <s:color name="CommandLinksDisabled" value="B1B1B1" />
    <s:color name="BackgroundOverlay" value="D8FFFFFF" />
    <s:color name="DisabledBackground" value="FDFDFD" />
    <s:color name="PageBackground" value="FFFFFF" />
    <s:color name="HeaderBackground" value="D8FFFFFF" />
    <s:color name="FooterBackground" value="D8FFFFFF" />
    <s:color name="SelectionBackground" value="7F9CCEF0" />
    <s:color name="HoverBackground" value="7FCDE6F7" />
    <s:color name="RowAccent" value="FF0000" />
    <s:color name="StrongLines" value="FF9696" />
    <s:color name="Lines" value="ABABAB" />
    <s:color name="SubtleLines" value="C6C6C6" />
    <s:color name="DisabledLines" value="E1E1E1" />
    <s:color name="AccentLines" value="FF3939" />
    <s:color name="DialogBorder" value="F0F0F0" />
    <s:color name="Navigation" value="666666" />
    <s:color name="NavigationAccent" value="FF0000" />
    <s:color name="NavigationHover" value="FF0000" />
    <s:color name="NavigationPressed" value="9B0000" />
    <s:color name="NavigationHoverBackground" value="7FCDE6F7" />
    <s:color name="NavigationSelectedBackground" value="C6EFEFEF" />
    <s:color name="EmphasisText" value="FFFFFF" />
    <s:color name="EmphasisBackground" value="FF0000" />
    <s:color name="EmphasisHoverBackground" value="C60000" />
    <s:color name="EmphasisBorder" value="C60000" />
    <s:color name="EmphasisHoverBorder" value="9B0000" />
    <s:color name="SubtleEmphasisText" value="666666" />
    <s:color name="SubtleEmphasisCommandLinks" value="262626" />
    <s:color name="SubtleEmphasisBackground" value="F1F1F1" />
    <s:color name="TopBarText" value="666666" />
    <s:color name="TopBarBackground" value="C6EFEFEF" />
    <s:color name="TopBarHoverText" value="333333" />
    <s:color name="TopBarPressedText" value="9B0000" />
    <s:color name="HeaderText" value="444444" />
    <s:color name="HeaderSubtleText" value="777777" />
    <s:color name="HeaderDisableText" value="B1B1B1" />
    <s:color name="HeaderNavigationText" value="666666" />
    <s:color name="HeaderNavigationHoverText" value="FF0000" />
    <s:color name="HeaderNavigationPressedText" value="9B0000" />
    <s:color name="HeaderNavigationSelectedText" value="FF0000" />
    <s:color name="HeaderLines" value="ABABAB" />
    <s:color name="HeaderStrongLines" value="FF9696" />
    <s:color name="HeaderAccentLines" value="FF3939" />
    <s:color name="HeaderSubtleLines" value="C6C6C6" />
    <s:color name="HeaderDisabledLines" value="E1E1E1" />
    <s:color name="HeaderDisabledBackground" value="FDFDFD" />
    <s:color name="HeaderFlyoutBorder" value="D1D1D1" />
    <s:color name="HeaderSiteTitle" value="262626" />
    <s:color name="SuiteBarBackground" value="FF0000" />
    <s:color name="SuiteBarHoverBackground" value="FF6464" />
    <s:color name="SuiteBarText" value="FFFFFF" />
    <s:color name="SuiteBarDisabledText" value="FF9696" />
    <s:color name="ButtonText" value="444444" />
    <s:color name="ButtonDisabledText" value="B1B1B1" />
    <s:color name="ButtonBackground" value="FDFDFD" />
    <s:color name="ButtonHoverBackground" value="E6F2FA" />
    <s:color name="ButtonPressedBackground" value="FF9696" />
    <s:color name="ButtonDisabledBackground" value="FDFDFD" />
    <s:color name="ButtonBorder" value="ABABAB" />
    <s:color name="ButtonHoverBorder" value="FF9696" />
    <s:color name="ButtonPressedBorder" value="FF3939" />
    <s:color name="ButtonDisabledBorder" value="E1E1E1" />
    <s:color name="ButtonGlyph" value="666666" />
    <s:color name="ButtonGlyphActive" value="444444" />
    <s:color name="ButtonGlyphDisabled" value="C6C6C6" />
    <s:color name="TileText" value="FFFFFF" />
    <s:color name="TileBackgroundOverlay" value="7F000000" />
    <s:color name="ContentAccent1" value="FF9339" />
    <s:color name="ContentAccent2" value="C65A00" />
    <s:color name="ContentAccent3" value="24A0A0" />
    <s:color name="ContentAccent4" value="007777" />
    <s:color name="ContentAccent5" value="2FCF2F" />
    <s:color name="ContentAccent6" value="009E00" />
</s:colorPalette>

And to be honest I do not see the colors behind a six-digit hexadecimal code … yet!
And I think I want to keep it like that.

But today, a dear colleague of mine showed me how easy it can be to get started in less than 10 minutes when you have the right toolset which in this case is provided by Microsoft itself.

Here is what he showed me:

Download the SharePoint Color Palette Tool from the Microsoft Download Center here.

SharePointColorPaletteTool

The tool is easy to handle and self-explaining. (Feel free to contact me if you have questions)

You can use one of the many tools out there to create a color scheme.
We used http://paletton.com in this example.

Just put the hexadecimal color codes into your SharePoint Color Palette and save the file.

Now you can upload the *.spcolor file to SharePoint manually or you use a SharePoint App to deploy the file to SharePoint. Chis O’Brien explained the second way in his blogpost SP2013 host web apps: provisioning files (e.g. master pages) to the host web.

Unfortunately there is no editor for for the *.spfont files. But you can use your own fonts in SharePoint 2013 by providing a custom .spfont file. For more Information about both file types take a look at the MSDN article Color palettes and fonts in SharePoint 2013