Category Archives: SharePoint 2013

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.

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)

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.

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.

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

SharePoint 2013 URL Trailing Slash causes Video to disappear

It was like every other Monday in my work life.
I got a call that started like this: “SharePoint is not working…”
Well…after 10 minutes I got a more precise description of the problem and I found the issue kind of funny and share worthy.

Background

We developed a Web Part that aggregates News using SharePoint Search.

Issue Description

A User created a new “News Article Page” and added a Video Web Part to it. Everything was working fine. This new page was picked up by the SharePoint Search Crawler and displayed in the Web Part we created. When a user clicked on the Link to the News Article Page the page was rendered fine except that the video was gone.

Solution

Obviously 😉 I first compared the two URLs and I found a trailing slash (/) in the URL that came from the Web Part. When I removed it everything worked fine. The “Path” Attribute you get from the search result has always a slash (/) at the end. I just fixed the source code by adding a .TrimEnd(‘/’) to the URL String and everything worked great.

 

SharePoint 2013 – Error in SPJobDefinition.Update()

I discovered the issue during the migration of my SharePoint 2010 solution to SharePoint 2013. I have a custom generic SPJobDefinition that was working perfectly fine in 2010, but in 2013 I got the following Error…

SPJobDefinitionError

Error Page

From the call stack you can tell that there is a parameter named FullName in a Stored Procedure named proc_putClass() and the parameter is to long.

So I took a look in the Stored Procedure Microsoft.SharePoint.SPStoredProceduresConfig.proc_putClass() which can be found in the ConfigDB of SharePoint. Here is what I found…

…obviously FullName is a nvarchar with 256 characters.

Next I checked the Microsoft.SharePoint.Administration.SPConfigurationDatabase.StoreClassMetadata(Type type) Method and I found this line of code calling the proc_putClass() Stored Procedure.

According to the call stack you can see that type is in this case the Type of our SPPersistedObject which is of course our custom SPJobDefinition.

The problem now was pretty obvious. When I checked the Type of my custom SPJobDefinition I found a very very long string with almost twice as much characters than 256.

You can check the Type string for example like that

[your SPJobDefinition object].GetType().AssemblyQualifiedName, or just check it during debugging.

 

Solution

My quick and easy solution was to keep my type signature under 256 characters.

 

But the Question is why does this happen?

Well, that is a very good question and the only answer I can give is maybe not good enough. The StoreObject(SPPersistedObject obj, bool storeClassIfNecessary, bool ensure) Method changed in SharePoint 2013.

How to enable a list as a catalog in SharePoint 2013 with Powershell

Configure a list as a catalog with PowerShell to automate cross site publishing configuration in SharePoint 2013.

Adds important Indexed Properties to the List.

Enables Anonymous Access to the Catalog. (To disable set to 0.)

Adds properties to the lists RootFolder to configure the list as catalog.

  • IsPublishingCatalog: sets the checkbox in the configure catalog page
  • PublishingCatalogSettings: configures the Catalog Item Url Fields and the taxonomy field for the Navigation Hierarchy
  • vti_indexedpropertykeys: Those Ids are the fixed Ids of the two Indexed Properties we added to the Lists IndexedRootFolderPropertyKeys.

Now you need to perform a full crawl to let the index catch the previously set indexed properties.