Wednesday, 27 February 2013

SharePoint Web Application Creation Error

 SharePoint 2010 Web Application creation error: "There is a duplicate 'Reporting Services/Data Extensions' section defined"
I was trying to create a new Web Application on my SharePoint farm and as soon as it was created, I got the following error:

When I try to browse to the site, I see a very helpful error.


Looks like a small problem.  So I went into the Web.Config file and removed that duplicate entry.

Problem was that now I got a "Server Error 500" when I tried to access the Web App's Site Collection.

I googled, fiddled, interogated logs.  All to know avail.

Eventually, in desparation, I decided to uninstall SharePoint and try again. 

Unfortunately, this time I got the above error as soon as I created the Central Admin Database.

So what was going ON?

In my case, I found that this was an issue with the Supplemental .Config file that I had created.

I had never created one of these before but, as per Microsoft Best Practice, the SharePoint Web.Config file should not be editied directly.  Changes should be made in a custom file, stored in %CommonProgramFiles%\Microsoft Shared\web server extensions\14\CONFIG

I took a loko in this directory and what should I see but not only my Supplemental file, but a very suspicious looking file called "Webconfig.rs". 

So, I removed my own Supplemental file and it resolved the issue.

I haven't figured out the exact cause of this issue yet. I suspect that as the Web Config file is updated when a new Web App is created was getting muddled.  Most probably caused by some malformed XML in my own file. 

The good news is that the problem is fixed and I can continue my install.

Thursday, 21 February 2013

Content Query Web Part - Sort by two columns

OK, this is a problem I have had to solve twice now so I am blogging it for my own reference - and for anyone else out there who might be interested.

SharePoint Content Query Web Parts only allow users to Sort By a single field.

In my case, I wanted to sort a news items listing by whether it was marked "Priority News" (a Yes/No field) and then by the Publishing Date.

There are other/smarter/more complex ways of achieving this. Indeed, to sort any more than two columns it will be necessary to look at some fancy XSLT or CAML.  But for now, this is a hack solution that a content administrator can do on their own without any more than a tiny bit of config and a single line of CSS (which I have provided :)).

In the Properties of the Content Query Web Part, select "Group By" and add your Priority News Yes/No field to it.  As you want the "Yes" values to appear first, select "Show groups in Descending Order".
Under Sort By, include the next field you would like to sort by.
Then (and here comes the trick), under Group Style, select "Whitespace".

All looking OK but you may still notice a bit of padding below each group.
As such, in your Custom CSS file, simply add the following line:

.whitespace { padding-bottom:0px !important; }