Building, Part 6: What Was Tough, and What’s to Come

Part 1 :: Part 2 :: Part 3 :: Part 4 :: Part 5 :: Part 6

This is part 6 of an ongoing series of posts about my experience building a custom site on top of Office SharePoint Server 2007. If you haven't yet read parts 1 through 5, I'd strongly suggest starting there.

In my last post, I discussed some of the final touches I put on my new site. In this post, I'll talk about things that I found particularly difficult during this project, and discuss some other ideas for features and functionality that might come in the future.

Content Query Web Part Limitations

I love the Content Query Web Part. It is pretty customizable in both result sets and presentation, it drives RSS feeds, and it generally solves the very real problem of aggregating content dynamically across a site. However, it has one core drawback that can be a bit annoying – it doesn't know where it is. What I mean by that is that a given CQWP doesn't know that it's in a specific subsite. In my site, I have a page layout for my rollup pages that includes a CQWP for the main content. I wanted to just add my CQWP to the layout and have it automatically aggregate content from only the current subsite. Unfortunately, because the CQWP isn't aware of its current location, you can't configure it that way. You must explicitly set a property on the part telling it what specific sites you want to aggregate content from.

While this is an unfortunately limitation, there is a way to make this work. You can write a small custom control that you add to your page layout that is aware of the current location and sets properties on the CQWP at runtime. This is the method I will be looking at pretty soon, because it also has the pleasant side-effect of letting me set web part properties at the page layout level. If my custom control sets the properties at runtime and lives in the page layout, then I can just modify it once and all of my rollup page CQWP's magically get updated. I'm not sure how this will impact performance of the part, so that's something to investigate if you're considering going down a similar road. The impact should be relatively negligible if you're making use of output caching.

Styling Issues

Another problem I ran into was around styling. Some things are pretty tough to style. The major culprits here are web parts. Web parts always want to inject their own chrome and color scheme into the page content. This was frustrating when using the CQWP, because I specified all of the markup I wanted in the XSLT styles, and then the web part would throw some random CSS style or table around itself when it rendered. You can still see markup like <td id="MSOZoneCell_WebPartWPQ2" valign="top"> and <div id="WebPartWPQ2" class="ms-WPBody"... in my page markup, even though I have the web parts configured to not output any of their chrome. Talk about annoying!

Most of this stuff ends up being pretty innocuous. However, some of the side-effects are that your CSS styles might not look right when content is being output from a web part, because your styles are cascading incorrectly because the web part (or more correctly, the web part zone) is throwing something extra into the markup. I got around this by adding some additional CSS class to make sure the web part CSS got overridden. For example:

.ms-WPBody a:link {


font-family:"Lucida Grande",Helvetica,Arial,sans-serif;




This works, but it's very annoying that I had to go this route in the first place. One other trick you can use if your web part doesn't live inside a zone is to set SuppressWebPartChrome="true" on the web part. This suppresses almost all of the web part chrome from being rendered. Unfortunately, this only works on web parts that don't live in a zone, which means that you can really only use this for page layouts. In my case CQWP's won't serve RSS feeds unless the web part lives in a zone, so I couldn't use this approach in most cases.

Another area that was a bit frustrating from a styling perspective was the search control. I haven't managed to get it right yet. If you look at my site in Firefox, the search box is not right-aligned like it should be. IE6 renders it right aligned, but I think IE7 does it like Firefox. Anyway, this is just another example of what can be frustrating when controls output presentation elements that aren't easily overridden. I'm sure I'll figure it out eventually, but just like with the web part styles, I shouldn't need to. I want a clear, unified way to style my page and I don't want controls usurping my look and feel that I painstakingly crafted.

This project was a lot of fun, but it certainly didn't come about without a share of challenges. I toyed with several designs or options in various sections of the site before settling on the "final" solution, and things are far from done, and as is always the case, there are drawbacks to every solution. Some of the things I have written about in my posts have already been changed because I decided to try something different; no doubt more changes will come in the future.

In fact, I have a whole lot of ideas that I want to implement. Alas, time is short and I probably won't get to most of them, but I thought I'd mention a few because people might find them interesting.

Authoring in Word

Word 2007 has the capability to post to blogs using both the MetaWeblog and Atom APIs. The SharePoint blog template has a server-side implementation of the MWL API, so you can post to your SharePoint blog using Word, Windows Live Writer, or any other MWL-compatible authoring tool. But my site isn't a SharePoint blog. One of the core reasons I used the publishing features was because I had a specific look and feel I wanted for the site, and I wanted to be able to update that on a grand scale easily.

That said, there are a lot of features that blogs have that I would like to have on my site. One of those is the ability to create posts offline and post them later. To this end, I have been working on an implementation of the MWL API that knows how to post Publishing pages. I even have it working, though it's not ready for anyone else to use it or anything. If I manage to get it in releasable shape at some point, I'll put it on my site. But basically, my point is that with a little time and elbow-grease, you can make some services that extend the authoring capabilities of the system. George, another PM on my team, also built a prototype email handler that would create a publishing page based on incoming mail. There are lots of possibilities here, and the object model we have is robust enough to allow you to build you these sorts of things pretty quickly.

Forms Authentication, User Sign-up, and Comments

One of the things I'm missing from my old site is the ability for people to sign up for accounts and then either contribute posts or comment on existing posts. In order to support this, I need to switch over to use Forms Authentication (which is super easy because SharePoint has a pluggable authentication model) and build a sign-up page. Again, I have this working already, but it's not live yet. Once I make it live, people will be able to sign up for their own account, log in, and post content on the site (with my approval, leveraging the awesome workflow capabilities of SharePoint). If you're looking for more info on setting up forms auth, Andrew Connell has a great post at

Custom Layouts and Controls

I also have quite a few custom controls and layouts that I'd like to write. One big one is a custom DateTime control, because the default SharePoint one only allows you to set time in 5-minute increments. I demand more precision! :-)

I also plan to make a couple of controls for my music/movie/game/book reviews that will connect up to Amazon and load information about the item I'm reviewing. This should be pretty straightforward, since Amazon has an extensible web services framework.

Well, ladies and gents, I think it's time for me to bring this post series to a close. I hope that some of you have found the information useful. If you are interested in any future projects I do for the site, I encourage you to visit, or subscribe to a special RSS feed that is tailored to my more technical audience. This feed only has items from my Work and Projects sections. I figured some of you might not be interested in my poetry, music, or book reviews, but if you are, hey, there are feeds for that too. :-)

I doubt this is the last you've heard of me, though, so until next time...

Part 1 :: Part 2 :: Part 3 :: Part 4 :: Part 5 :: Part 6