I looked for hours! I can’t find this thing anywhere else on the internet! There must be a complete group of developers and designers that have been struggling with this before! I can’t believe I’m supposed to be the first one to put this solution on the world wide web.

All I wanted to do is to disable the wordwrap in a specific div in SharePoint, like so:

white-space: nowrap;

It worked perfectly in all browsers, except for… That’s right! Internet Explorer!

After struggling for half a day I finally found out that SharePoint inserts another piece of styling called word-wrap. This is the SharePoint code:

word-wrap: break-word;

All I had to do is override this in my own style and voila, it finally works!

And now the working style looks like this:

white-space: nowrap;word-wrap: normal;

My Story

By default, it’s only possible to sort on relevance and modified date in the Core Results Web Part. And it also isn’t possible to give a sorting direction, it’s always descending.

Now a client wanted to show the last created discussions on the homepage of it’s SharePoint, off course sorted by creation date. Out of the box this isn’t possible, but luckily somebody else had the same problem and came with a neat solution: http://www.insidesharepoint.net/post/2011/02/16/Creating-a-sortable-CoreResultsWebPart-in-SharePoint-2010.aspx

I played around a bit with that code, but couldn’t get it to work. The most common error I got was Property doesn’t exist or is used in a manner inconsistent with schema settings.

At this time of writing my expertise in the SharePoint Search maze isn’t that great, but I read something about a Managed Metadata Properties in the blog post. After playing around with custom managed properties for a while I finally got it to work. The trick is to create a custom Managed Property with mappings to, in my case, Basic:15;ows_start_x0020_Date,Office:12;creationdate and do a full crawl. Important! Do not do an incremental crawl! That will definitely not work! I cracked my head on that one already!

And then it works!

You could also forget the story above and follow the instructions beneath

These are the steps I took to work out my case, which is sorting Team Discussions by Creation Date.

First I created a scope named Discussions with a rule contentclass = STS_ListItem_DiscussionBoard.

Then I created a Managed Metadata Property named Created with a few mappings and settings like below.

Next thing to do is to start a full crawl. No incremental, that won’t work!

Now we can create our own Web Part. Create a new Visual Studio 2010 project, call it SortableCoreResultsWebPart. Add a reference to Microsoft.Office.Server.Search and add a new Web Part to the project, no Visual Web Part, just a regular. Name it SortableCoreResultsWebPart.

Open the SortableCoreResults.cs and overwrite the code with the following code.

    public class SortableCoreResultsWebPart : CoreResultsWebPart
        [WebDescription("Sort by this managed property")]
        public string OrderByProperty { get; set; }

        [WebDescription("Sort direction")]
        public Microsoft.Office.Server.Search.Query.SortDirection SortDirection { get; set; }

        /// <summary>
        /// Override. First runs the base code, than collects the CoreResultsDatasource and
        /// sets the SortOrder property.
        /// </summary>
        protected override void ConfigureDataSourceProperties()
            // only do stuff when search results are visible
            if (this.ShowSearchResults)
                // run the base code
                    // if OrderByProperty is not set, use default behaviour
                    if (!string.IsNullOrEmpty(OrderByProperty))
                        // get the datasource and change the sortorder
                        CoreResultsDatasource dataSource = this.DataSource as CoreResultsDatasource;
                        dataSource.SortOrder.Add(OrderByProperty, SortDirection);
                catch (Exception)
                    // handle this error! and show a friendly error message

Don’t forget to add an using for Microsoft.Office.Server.Search.WebControls.

Run the thing and add the Web Part to the page. An error will pop up saying SrhdcNoKeywordException was unhandled, skip it by pressing F5 or clicking continue a couple of times.

Edit the Web Part, open the Location Properties and modify the scope to Discussions. Open Result Query Options and modify Fixed Keyword Query to contentclass:STS_ListItem_DiscussionBoard. Finally fill the OrderByProperty with Created and set a SortDirection.

 Save and refresh the page. Watch your web part sort like Dustin Hoffman in Rain Man!

For .NET

Resharper (free-to-try, €131)

Resharper is an extension for, in general, intellisense. It’s very powerfull in different ways. E.g. it checks your code for compiling issues on-the-fly and giving possible options to resolve it automatically.


BugAid (free-to-try, $49)

BugAid is an extension for the variable watcher in debug-mode. Convince yourself with this video http://youtu.be/0GuAq76-D-s.


For SharePoint

CKS: Development Tools Edition (free)

This project extends the Visual Studio 2010 SharePoint project system with advanced templates and tools.  Using these extensions you will be able to find relevant information from your SharePoint environments without leaving Visual Studio.


Visual Studio 2010 SharePoint Power Tools (free)

Also extends Visual Studio 2010 with templates and tools, especially focussed on sandboxed solutions.


People get lazier every day. I guess it’s some kind of evolution. A few thousand years ago we used to make our own tools. We had to go out into the woods to hunt for a meal,  and with a bit of luck we had a piece of meat at night. Nowadays we drive to work, bang on the keyboard for 8 hours, drive back, and at home a not too scanty meal magically appears on the table. Did we hunt for that? Did we make our own car? Did we make our own PC? Did we even make our own OS? We didn’t even sweat! In the history of mankind someone apparently was smart enough to not kill the caught animal, but let it jump on top of a female of the same kind, and then wait for the beef to spawn on his plate. People get smarter, so they can be lazier. Evolution.

Now back to SharePoint. SharePoint is the perfect platform for the current generation of people. We can find all of our documents, tasks and emails in one place. People even expect one overview for content spread across multiple sites. To achieve this kind of content aggregation, SharePoint 2010 has a few tools available.

In the latest SharePoint eMagazine of the DIWUG (Dutch Information Workers User Group) Brett Lonsdale writes about the multiple tools SharePoint has, that can achieve content aggregation over multiple lists, sites, site collections and even farms. I would really recommend reading the article, but for the lazy (or more evolved) readers, here is a summary.

  • Content by Query Web Part – This is part of the Publishing Infrastructure Feature. It allows you to aggregate content from lists of the entire site collection. This can be done by simple clicking and selecting. This also applies to filtering, grouping and sorting. Out of the box there are multiple styles available, but you can also create your own style by copy and modify a XSL in the Style Library.
    The CQWP is a very powerful tool for content in one site collection. It won’t work with multiple site-collections.
  • Relevant Documents Web Part – This is a very simple web part which doesn’t allow much configuring. You can show your last modified documents, or the documents you created, but it doesn’t get more exciting than that. Oh, and you have to keep in mind that it’s only for the current site, not for the site collection.
  • RSS Feed Web Part – The RSS Feed web part can show the RSS feed of a SharePoint List. If you are using Kerberos you can get the RSS feed of a list in the web part. This is useful across site collections.
  • Data View Web Part – This web part can be found in every SharePoint 2010 version, even foundation. The RSS feed can also be used in this web part. Even more, multiple RSS feeds can be merged, talking about content aggregation. In SharePoint designer there is even more available with this web part. Data sources can be web services, databases, xml, etc.
  • Core Search Results Web Part – This web part is useful when you want to aggregate content of multiple site collections. This can be done by configure a search scope with properties and rules in central admin. One big disadvantage is that the content is as up to date as the latest crawl.
  • Calendar Overlays – In a SharePoint calendar you can get an overlay using the Calendar Overlays button on the ribbon. This function is pretty straightforward.
The Content Query Web Part is a very powerful OOTB tool for content aggregation. If you want even more then use the Data View Web Part in combination with SharePoint Designer.

In my previous post on how to design and deploy a custom SharePoint master page I explained how to create an own branded master page and how to deploy that master page to your SharePoint site. Now I first stumbled upon the problem that the master page doesn’t get automatically applied to newly created (sub)sites, and secondly I received a comment from a reader describing the exact same problem. So I decided to write my findings and solution to the open world. Here it is.

The problem is very simple: You create your own master page, you apply your master page to all sites and it does that, nice, but when you create a new site you just get the old v4.master on that site and not your custom master page. Everyone with this problem, if you followed my previous post or not, can follow this solution. It doesn’t even matter what SharePoint version you’re using.

When I Googled for a bit, I found out that there is no out-of-the-box-solution for this and a lot of guys use Visual Studio to solve this. You could program an event receiver that sets your master page to every new site. Or you could program a Feature that holds your master page and apply that feature to a site definition. But I find that a bit heavy and not very flexible solution. So I played around a bit and found a solution myself without the use of Visual Studio or programming at all.

Here we go:

You should have your master page deployed to the main sites master pages gallery. You should see your masterpage when going to http:///_catalogs/masterpage/Forms/AllItems.aspx

(Yes I’m using Chrome)

Now create a new blank Team Site using whatever name you like (you won’t see it in the end).

Now go to Site Settings and click “Save site as template” under Site Actions and go save the site as a template.

On the next screen click on the link to go to the solution gallery. In the solution gallery just click on the name of your just created template to download it. Save it somewhere where you can easily find it.

Did you know that as WSP is in fact just a CAB file? That’s why we need a tool that can extract and recreate our wsp. I used the tool ACDZip, which has a free x-days trial. You can get it here http://acdzip.findmysoft.com/. A reader has also mentioned the tool IZArc, which is free. A great alternative.

Now find your file and rename it from TemplateWithoutMyMasterPage.wsp to TemplateWithoutMyMasterPage.cab, you should see your icon change.

Open the file with ACDZip and extract the ONet.xml file from theWebTemplateONet.xml to a location where you can edit it easily.


Now edit the following line of code

masterpage/v4.master" ThemedCssFolderUrl="">


<Configuration ID="0" Name="Default" MasterUrl="/_catalogs/masterpage/mymaster.master" ThemedCssFolderUrl="">

Don’t forget the slash before _catalogs. This will ensure that the mymaster.master from the master page gallery on the root of the site gets used.

Save the file and put it back in the archive (drag and drop), it will automatically rebuild the archive. Rename the file back to a wsp file, I also used another file name.

Upload the file into the Solution Gallery by using the Upload Solution button on the ribbon of Solutions.


In the next screen you must upgrade the solution.

You can now use the new template to create a site with your masterpage. Go ahead and try. Site Actions, New Site, scroll down and select the template, fill in a title and url and create the site.

You should now have your master page automatically applied.

You ever wanted to show external data in SharePoint? Do Arabs fart in the desert? Does Apple charge 200 dollars extra for a different color macbook?

Of course you want to show external data in SharePoint. But it isn’t as easy as it seems to achieve this. There are a few methods and every methods has it’s pro’s and con’s.

According to Microsoft the best method, and every SharePoint guru will agree, is Business Connectivity Services. This method is great for creating a seamless connection between SharePoint and your external data. It however has the big disadvantage that BCS can only be used in conjuction with the external list, and external lists cannot have additional columns. This means that a calculated column needs to be custom developed in the BCS model, which in turn means that it needs to be compiled, tested, deployed, etc. And this is pretty stupid because SharePoint has calculated columns out of the box with a custom list. Now, I´ve tried to get that BCS data into a custom list, but with no success. So then I started looking for a way without BCS and use SQL Server Integration Services(SSIS) instead. After googling for a while I found exactly what I was looking for.


This solution can synchronize a database with a custom list. It however is one-way, so customized data in the list doesn’t get back into the database. But because it’s a custom list we can use calculated and other additional columns.

Prerequisites for this SSIS solution.
You need to have SQL Server Standard or higher with Integration Services enabled and Business Intelligence Studio installed.
Then you need the following plugin for the SharePoint list source and destination.

This post explains how to create a new master page with a custom stylesheet and some custom images. We do this with the following steps:

  • Install  master page picker
  • Create a new master page
  • Create a stylesheet
  • Create an images folder
  • Prepare master page
  • Edit master page
  • Deploy master page

Install master page picker
First we need a feature that is going to deploy our new master page to the sitecollections. Because the Foundation version doesn’t have a master page selector, I used this fantastic very-easy-to-install feature:


It also enables us to change the master page from within the sitecollection properties.

Create new master page
The next thing to do is to copy the existing master page.

From within Sharepoint Designer you can go to the Master Pages section and copy the v4.master in the same folder and rename it to whatever you want. I generally choose the clients name.

Tip! In the folder you also find a default.master and a minimal.master file. The default.master is the old 2007 master page. The minimal.master is a master page with only the base controls, no layout whatsoever. I always use a copy of the v4 master page and not the minimalistic one, because it’s more efficient to tweak the existing master page instead of creating a new one based on the minimal.master.

Create stylesheet
We also want to apply our own custom stylesheet to the masterpage so let’s create a stylesheet.

Go to the folder Common FilesMicrosoft SharedWeb Server Extensions14TEMPLATELAYOUTS1033STYLESThemable and create an empty mystyle.css file.

Create an images folder
Now create a new folder inside the Common FilesMicrosoft SharedWeb Server Extensions14TEMPLATEIMAGES named myimages.

Tip! We create a new folder to keep our images separated so they won´t be mixed up with the ones that come with Sharepoint. Another reason is that future editing would be easier because our images are easier to find, naturally.

Prepare master page
We are going to prepare our master page to use our custom stylesheet.

Go to Sharepoint Designer and open the edit view for the mymaster.master and click the code view. Now insert the line

<sharepoint:CSSRegistration Name="/_layouts/1033/Styles/Themable/mystyle.css" After="corev4.css" runat="server"/>

just before the </head> tag. Then save the file and accept the warning for the customized page. The After=”corev4.css” ensures that the style elements in our custom stylesheet override the default css.

Edit master page
In this example I’m going to change the color of the selected ribbon header from it’s dark grey to a solid blue color. Now browse to the sharepoint page and check the html source to find out which class is being used by the selected ribbon header. In my example the class for the header of the selected ribbon is .ms-cui-tts > .ms-cui-tt-s > .ms-cui-tt-a > .ms-cui-tt-span (do you wanna know how to find these style classes easily? Check the next tip). Now we go to our mystyle.css and create this class here and give it our blue color style.

.ms-cui-tts > .ms-cui-tt-s > .ms-cui-tt-a > .ms-cui-tt-span {
    color: #0069b0;

Save the CSS file.

Tip! I highly recommend the usage of developer tools for your browser. I always use Google Chrome with the built-in developer tools. They are very accurate and easy to use. In Chrome, rightclick the item you wish to know the style from and click Inspect element. At the right side of the window you find matched CSS Rules. You can copy a CSS rule and paste it in your mystyle.css and tweak it the way you want it.

Deploy master page
Now we wan’t to test our new master page. Before we can do that we need to select it with the master page picker we installed in the first step.

Go to your sitecollection  settings and go to the Master Page Picker which can be found under the Look and Feel category. Our new master page will be displayed in the list, select it and click ok to apply our new master page to the sitecollection.

Now go to the site and check our result. The selected ribbon header text color is now blue, thumbs up!

When you use images in your stylesheet or master page then put the image in the myimages folder and reference it with the following url


Get classnames for hover items
Tip! It may be difficult to find the hover style of some elements. In Google Chrome you can do this by rightclicking the item and leave your cursor where it is and browse the menu with up and down keys on the keyboard, then select Inspect element and press enter. At the rightside of the window you now find the classnames for the hover of the item.


Some readers ran into  an error when using their new master page. The error reads The expression prefix ‘SPUrl’ was not recognized. Please correct the prefix or register the prefix in the section of configuration. This is because SharePoint Foundation doesn’t support the SPUrl prefix out of the box.

There problem is with this line of code in the master page:
Name="<% $SPUrl:~sitecollection/_layouts/1033/Styles/Themable/mystyle.css %>"
After="corev4.css" runat="server"/>

A simple solution is to just simplify the code to this
After="corev4.css" runat="server"/>

A more time-consuming but maybe better way is this: http://buyevich.blogspot.com/2010/10/spurl-for-wss-30-or-sharepoint.html


If you want your master page to automatically get applied with every new site you create, please read this post: