Rock My Website: download winners' code

November 24th, 2007 by waldek mastykarz

A while ago John, Martijn and myself have won the Rock My Website competition. John has mentioned this earlier in one of his posts.

We have chosen to develop our project using ASP.NET 2.0. Quite challenging we thought – especially if you consider the automation level of ASP.NET and the amount of code generated by the framework. To reach the desired accessibility and compliancy level we have used various techniques like custom Page class, JavaScript classes and alternative style sheets.

After the competition we have received quite a few questions regarding our approach and the techniques we have used. To make it more transparent for all of you interested in accessibility and compliance of ASP.NET 2.0 based websites we have decided to share the code of our project. As you the competition has been organized and hosted by Microsoft Netherlands. That is why we have chosen to make our code available as a Starter Kit. Unfortunately Microsoft didn't seem to be interested in our solution and didn't really see the added value of the whole idea. Quite a pity in my opinion considering Microsoft's web products are not really known as top-compliant.

Anyway we didn't get discouraged. We have decided to put the project on our CodePlex Project site so you can download it and use our techniques in your projects. The site content and our accessibility statement are both in Dutch. Don't get discouraged by any of these though: feel free to comment our code and ask any questions about it.

Why is this important? Although we haven't used all of the rich functionality of ASP.NET it might give you an idea on how to achieve a high compliancy level using this framework. And because SharePoint 2007 is built upon ASP.NET 2.0, well… 2+2=?

Inconvenient StringToSPViewType (Programmatically adding Views)

November 23rd, 2007 by waldek mastykarz

I've just stumbled upon a little inconvenience within SharePoint object model. As I needed to programmatically add a new View to a list, I have used the StringToSPViewType method of SPViewCollection class to convert a string representation of the view type to its SPViewType equivalent. Unfortunately all what I've got was an Argument Exception: Value does not fall within the expected range. Using the Lutz Roeder's Reflector I've taken a look into the assembly and I've found the reason of this problem.

If you look at the SDK SPViewType enumeration definition, you will see that all the values are given using Pascal case, eg. Html. But if you pass your string equivalent ("Html") it won't work and furthermore it will result in a exception. It has to do with the way SharePoint object model converts the string value to SPViewType. It uses a dictionary with the same values as given by the SDK but then written uppercase! If you try to get a value of the Html dictionary item it fails, because there is HTML only within the dictionary.

I think the way this method should be used in scripting scenario's is to use the SDK values and make this uppercase within the custom method before passing it to the StringToSPViewType method.

PlaceHolderPageTitle is the root of all evil

November 19th, 2007 by waldek mastykarz

Recently we have been experiencing some serious problems while working on our newest project. As we needed a customized version of the Publishing Portal template we have made a new version adjusted to our needs. What we needed to do is to reference the customized Master Page and create a default Welcome Page using one of our Page Layouts. And then it's started.

First of all we got some really strange error messages like 'Page contains illegal characters', etc. After stripping the whole Site Definition and having looked at every comma out there I have found something strange was going on with our Page Layouts. At the bottom of each one of them I've found:

<html xmlns:mso="urn:schemas-microsoft-com:office:office"xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"><head>
<META name="WebPartPageExpansion" content="full">
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:PublishingPreviewImage msdt:dt="string"></mso:PublishingPreviewImage>
<mso:ContentType msdt:dt="string">Page Layout</mso:ContentType>
<mso:MasterPageDescription msdt:dt="string"></mso:MasterPageDescription>
<mso:PublishingAssociatedVariations msdt:dt="string"></mso:PublishingAssociatedVariations>
<mso:PublishingHidden msdt:dt="string">0</mso:PublishingHidden>
<mso:PublishingAssociatedContentType msdt:dt="string">;#Agenda item;#0x010100C568DB52D...;#</mso:PublishingAssociatedContentType>
</mso:CustomDocumentProperties>
</xml><![endif]-->
<title>Dummy Content Type</title></head>

Because the deployment using Features didn't work I have tried using the Upload button in the Master Page Gallery. Still the extra piece of code has been added at the bottom of the uploaded Page Layout.

The next thing I've tried was uploading a Page Layout from one of our previous projects. Amazingly this one was ok! After analyzing the content of the Page Layout I've found out that the only difference was the

<asp:Content contentplaceholderid="PlaceHolderPageTitle" runat="server">
    <SharePointWebControls:FieldValue id="PageTitle"    FieldName="Title" runat="server"/>
</asp:Content>

At the beginning of the project I've removed this piece of code from the Page Layouts because I've created a custom control writing the complete title string using the current hierarchy. After all the hours spent on this bug I've found that you should never remove the above piece of code – whether you use is or not. It seems that removing it causes SharePoint not to recognize the uploaded Page Layout as a Page Layout what makes it add the selected Content Type reference at the bottom of the file.

Waldek Mastykarz is now 70-542 certified

November 18th, 2007 by waldek mastykarz

Last Friday I have taken the Microsoft Office SharePoint Server 2007, Application Development (70-542) exam and passed it with a nice 100%!

The exam itself is not that difficult. It might get tricky though if your company doesn't deliver solutions using all of the 6 SharePoint slices but is specialized in one of them like for example Web Content Management.

It's my first step on the SharePoint certification road. Coming Friday I will be taking another SharePoint exam: the Microsoft Office SharePoint Server 2007, Configuring (70-630). Furthermore I also want to become certified WSS developer.

Certification is important: although it's rarely a measure of your skills it means quite a lot for the customers who tend to have more trust in certified professionals.

ASP.NET events can cause troubles

November 17th, 2007 by waldek mastykarz

…if you are developing a Webrichtlijnen compliant website in ASP.NET or let's say in… SharePoint 2007!

Recently a new version of the Webrichtlijnen on-line quick scan tool has been released. Not that long ago I have reported that my concept on making SharePoint 2007 sites 100% Webrichtlijnen compliant did work. As soon as I have checked the same code using the newer version of the quick scan tool I have found there were still some errors present in the website.

These errors are JavaScript events related and these are attached to the ASP.NET controls. Let me explain it to you by using an ASP.NET button as an example.

So let's say you're making a custom search Web Part: a text field to enter the search query and a button to run the search. Using the ASP.NET events concept you create a new OnClick event for the button and you attach it to your button. What ASP.NET does is it creates a JavaScript onclick event and attaches it to the output. What you see in the source code of the rendered page is something like <input type="button" onclick="…. Why is this a problem?

Conform the Webrichtlijnen you are supposed to be using non-obtrusive JavaScript. Any in-line events are therefore forbidden. An onclick attached to a button or any other control is a no-go. But does it mean you cannot use these events at all? Well, it depends. If you're building a quite simple Web Part like the one above you could use one of the Web Part's methods triggered on postback instead and then check the value of the textbox. Another option would be catching the ASP.NET output and rewriting the inline events with their unobtrusive equivalents – I really wish you success with this one though.

Both server- and client-side events in ASP.NET are definitely something to take into consideration while developing Webrichtlijnen compliant websites. As Internet facing websites based on SharePoint 2007 are most of the times highly customized you as developer are in control of the output and the way you implement your business logic into the custom control. It is doable but it requires some more creativity than a regular SharePoint solution.

Another Internet facing website based on SharePoint 2007

November 14th, 2007 by waldek mastykarz

…Coming soon – really soon.

Last week we have started realising a new project for one of our customers: an Internet facing website based on SharePoint's 2007 WCM. It would've been 'just another' plain SharePoint 2007 WCM solution, but since we love new challenges here at Imtech ICT Business Solutions we have decided to use our last concept: developing Webrichtlijnen compliant SharePoint 2007 sites.

Since the project has just started we have the possibility to take this extra requirement in consideration in all the custom features we're going to deliver and just get sure it's all Webrichtlijnen compliant.

As far as I know there are no Webrichtlijnen compliant SharePoint 2007 based websites out there. It's extra challenging then to be the first one to prove it is actually possible. As there are many people waiting on the official release of the AKS who do care about accessible and compliant websites, it seems to me a really nice show case for our lightweight compliancy kit.

John (also member of the development team on this project) and I will post our experiences on regular basis so check out our blog once in a while if you are interested in accessibility in SharePoint and the things we have stumbled upon during the project.

And if you're more interested in the toolkit itself: I've been recently invited to give a presentation about accessibility challenges in SharePoint 2007 at Dutch Information Worker User Group on November the 29th. It is supposed to be an interactive session so meet me there if you have any questions and I will try to answer them.

TechEd Developers 2007 Barcelona personal highlights

November 11th, 2007 by john.bruin

We had to leave on Sunday from Amsterdam at 4:30 AM to get the plane to Barcelona at 6:55 AM. At the airport at 5 o’clock in the morning 3(!) non Dutch speaking employees at Starbucks were needed to get us a double espresso. This must be very good for employment and integration!

We arrived at 9:00 AM in Barcelona and after checking into the hotel and picking up our TechEd conference bags we were ready to explore Barcelona. It took some time to find our way in the metro but once you know, you like it.

We have visited the amazing Sagrada Familia, the home of FC Barcelona Camp Nou and of course La Rambla where we enjoyed the nice weather with tapas and beer.

On Monday at day 1 of the TechEd we arrived early to do some hands-on labs and to explore the conference place.

We were very surprised that with over 4000 visitor we had found a very nice and quiet spot to get online and enjoy our lunch. During lunch we were told that delegates were not allowed to join the speakers lounge (oops!) but we could finish our lunch and had a very nice chat with Howard Dierking who is Editor-in-Chief of MSDN Magazine.

At 14:00 Mr. S. (Soma) Somasegar welcomed us at the keynote. It is hard to believe the corporate vice president of the developer division cannot pronounce the word "developer".

Roy Osherove did a very good presentation on Agile development but the best of his presentation was his song “Every build you break” (from “Every breath you take” – Police) a few lines that I remember: Every build you break, every change you make, I will be watching you…

Accessibility and MOSS always have our special attention and we were very interested in the session about AKS (Accessibility Kit for SharePoint). We are very disappointed by the fact that the kit will not be very useful in our Dutch situation (see Waldek's post).

A developer of Gaia Ajax Widgets had contacted us through our blog and we visited their stand to say hello. They did a very good job on their product but I think they try to mimic a Windows application to much…

In the rest of week we focused mainly on MOSS 2007 development and ASP.NET and we were certainly not disappointed. 

Ted Pattison has a very good reputation in the MOSS community and now I know why. Ted is a great speaker who brings the information simple and clear. A great eye-opener for me!

Patrick Tisseghem and Jan Tielens from U2U in Belgium also have made their good reputation in the community come true.

We have also bought 3 books on MOSS 2007 development:

  1. Inside Microsoft Windows SharePoint Services 3.0 – Ted Pattison; Daniel Larson
  2. Inside Microsoft Office SharePoint Server 2007 – Patrick Tisseghem
  3. Real World SharePoint 2007 – Indispensable Experiences From 16 MOSS and WSS MVPs

Although ASP.NET 2.0 already exists for a couple of years now there were some very good deep diving sessions especially the one of Rob Howard of Telligent.

Microsoft is eating his own dog food. A very good example of this is the TechEd website. It is completely build on MOSS 2007. Every delegate has is own personal space where you can make your own calendar, give session feedback and meet other delegates. One drawback is that you have to remember yet another userID and password to access your personal space. Why not use your Live ID for that??

Speaking about dog food… The food at the conference was not very good and you could tell after the terrible smell of the toilets. Although in between the sessions there was always plenty of coffee and refreshments and the organisation went very smoothly.

Microsoft Netherlands organised the Country drinks in CATWALK. This must be a very cool club when it is full of party people but with only 100 Dutch male developers and 3 females this was a very big disappointment. We have tried to compensate this with drinking to much Heineken which have seemed not a very good idea the next morning…

The latest trend in fashion will be the orange MSDN caps. Hundreds and hundreds of them were spread and taken away from the "Ask the Experts" area. I have also grabbed a nice and warm "Thinking Cap" from the Windows and Services stand.

Thanks to our employee Imtech ICT and to Microsoft for giving us this great experience! We are looking forward to TechEd 2008!

AKS won't help you

November 10th, 2007 by waldek mastykarz

At least if you are a Dutch SharePoint developer and you're supposed to deliver a fully Webrichtlijnen compliant, SharePoint based Internet facing site solution.

Earlier this week I've attended the presentation of HiSoftware AKS @TechEd Developers Barcelona. As they are busy with it quite for some time now without sharing any useful information I've been very interested and expecting quite a lot from the session. Every SharePoint developer knows that SharePoint's rendering engine is disastrous and it's definitely challenging just getting it right. Anyway there was this session.

'Building Accessible Web Sites Using Microsoft Office SharePoint Server 2007 and the Accessibility Kit for SharePoint'

First of all the HiSoftware guy didn't show up at all ­- kind of perfect presentation of your own product isn't it? Then there was that introduction by Ben Robb. Quite comprehensive but out of scope though: the subject was actually focusing on SharePoint instead of introduction to web accessibility and compliancy. It's definitely important to point out the most important reasons and business cases but that's it.

As I've already mentioned guys from HiSoftware have spent quite some time so far on developing the toolkit. And what we've seen on the demo? Rewritten SharePoint CSS and a few control adapters only! You have probably heard that they are first planning the release of the solution targeting Internet facing sites. Now how many of you actually use the beautiful BlueBand and the original Web Parts? I don't.

Does it mean it's all just for nothing? To quote Ted Pattison: `It depends'. AKS will eventually consist of not only the adapters and other customized files but will also have some heavy documentation like best practices and guidelines. It still might be useful in some scenarios.

The 1.1 version of the toolkit certainly will – at least it's what I hope. The second release is targeted to the collaboration part of SharePoint and we all know it's quite difficult to customize any of the views of other heavy collaboration controls.

So where do you fit in all that as a Dutch SharePoint developer?

If you have no experience with accessibility at all AKS will definitely give you a nice start off. But it won't solve your problems. You see Webrichtlijnen requires WCAG 1.0 Priority 2+ compliancy AND fully valid (X)HTML + CSS. Since AKS targets WCAG 1.0 Priority 2 and does absolutely nothing about the invalid markup produced by SharePoint you will eventually end up trying to gain any control on the rendered output or just giving it up and choosing for another CMS.
If you have read my previous post I have quite a different point of view on the whole problem. It works for me and I can prove it. What I've heard just recently is that the Dutch Information Worker User Group is interested in my approach and the way I have tackled the challenges. Who knows where that might end.

CSS causes JavaScript error while moving Web Parts in edit mode

November 1st, 2007 by waldek mastykarz

While working on an Internet facing Web Content Management SharePoint 2007 solution for one of our customers Erik has stumbled upon an interesting by-design feature in SharePoint 2007. At some point he has noticed that he couldn't move Web Parts anymore: clicking on any of the title bars would result in a JavaScript error.

When I've heard about this behaviour I almost immediately thought about the custom JavaScript code delivered by the interactive designer. Removing all of this from the Master Page has unfortunately proven that the custom JavaScript worked just fine and had nothing to do with the issue.

By debugging the error message I have found out that the error is being caused by a JavaScript function belonging to SharePoint: MSOLayout_GetRealOffset. Running through page's elements using DOM made me think about the custom Web Controls we have made. I have suspected overriding one of the render methods improperly causing the error. Still after stripping the Master Page from all the custom controls didn't help.

The last remaining piece of customization left were the various CSS files delivered by the designer. Run of ideas I removed it as well and… voill  – the bug was gone and the Web Parts could have been moved again!

After some research I have discovered that the error has been caused by the position property used with anything else than static. The error occurs while processing parent elements of the selected Web Part. The exception is being caused by uncaught attempt of reading the offset property of a null object. It seems like altering the position property causes the parent object (container) to be set to null.

This behaviour occurs only in Internet Explorer: it's the only browser that allows dragging & dropping Web Parts. As there are not many client side script debug tools for Internet Explorer available, it's quite difficult to find out the exact reason of this error at this point.

The best you can do at this moment is to avoid relative of absolute positioned wrappers containing Web Part zones. While fixing the chrome I have replaced the implemented position functionality with float. It works perfectly and you can't see any difference in the positioning of elements on the page. Another option is to set this property only in the View Mode. You have to note that the editing experience will vary (depends on the complexity of your chrome) from the view experience.

If you would like to research this bug further I have the very basic Master Page and an empty Page Layout for you. What you have to do is create a new Publishing Web and set the Master Page to the one I've made. Then you need to create a new Publishing Page using my empty Page Layout. The next step is to add a new Web Part (doesn't matter which one). As soon as you will try to drag it, you will get a JavaScript error. As soon as you remove the inline style of the div wrapper the error will disappear.

Accessible SharePoint 2007: It's now officially 100% Webrichtlijnen(NL)/WCAG compliant

October 24th, 2007 by waldek mastykarz

Yesterday I have found out that the bug we have found while testing our compliancy toolkit, is fixed. What you see now is the nice green 100%.

   

After I have published the first post about our SharePoint Compliancy toolkit I have realised that I haven't mentioned what the Webrichtlijnen actually is. As it's a Dutch product it doesn't have to be necessarily obvious to everybody what it contains.

Webrichtlijnen is a set of accessibility guidelines created on behalf of the Dutch government. In 2006 the Dutch government has noticed the increase of digital information systems hosted by Dutch government organisations. What's more they have notice the lack of accessibility implemented in these applications and websites. As they are supposed to improve the access to information and the involved business processes accessibility has become all of a sudden a must-have.

After a research the Dutch government has found out that there only a few companies capable of designing and developing accessible websites and that implementing it isn't that obvious, they have decided to define the guidelines for accessible websites. In their work they have used the WCAG 1.0 guidelines as a primary input. Unfortunately they have chosen for their own set of guidelines which is WCAG 1.0 Priority 2+ (1, 2 plus some guidelines from 3). And I mean unfortunately because there is no way at this moment to check whether your site is Webrichtlijnen compliant other than using the on-line scan tool they have developed.

Anyway after a research we have succeeded in making SharePoint 2007 based Web Content Management solutions Webrichtlijnen compliant. It also means our toolkit is capable of making SharePoint solutions WCAG compliant!

In the nearest future we are going to test our toolkit more in different situations and environments and we are going to extend it with extra features. I hope I will be able to share some more technical details with you really soon and in the meanwhile I await some interesting questions.