Saturday, June 30, 2007

SharePoint code snippets

Adam started posting a round of interesting SharePoint code snippets last week - take a look at them:

Change keyboard layout during login on Windows 2003 Server to Dutch(Belgian)

I started playing around with the Orcas VPC and off course it uses the English keyboard layout. Now I needed to change it to Dutch (Belgian).  Luckily I found here - How do I Configure the default keyboard layout during login .

Open registry and go to HKEY_USERS\.DEFAULT\Keyboard Layout\Preload . Change the value for the 1 key to 00000813.

Log off and check if it works - a complete list of the different keyboard layout codes is available at How do I Configure the default keyboard layout during login 

Technorati tags: , ,

Tuesday, June 26, 2007

Hotfix for Windows Workflow Foundation Delay Activity problems

Appararently there are some issues with the Delay activity when a SharePoint workflow gets dehydrated and later on loaded back into memory. There is a knowledge base article which describes these issues - KB932816 - You experience various problems in Windows Workflow Foundation . The KB suggest that you contact Microsoft Customer Support Services to download the fix but I guess that this is actually the publicly available hotfix - A Microsoft Windows Workflow Foundation timer does not resume correctly after reloading a workflow

Wednesday, June 20, 2007

Importing and exporting webparts in SharePoint 2007 using the object model

I have been working on a little utility to move webparts from one site to another using the ImportWebPart and ExportWebPart methods of the SPLimitedWebManager class. Here are already some code snippets which give you an idea what I'm doing.... I'm also going to incorporate some ideas which I found in this blog posting - Customizing MOSS 2007 My Sites within the Enterprise.

SPSite sitecollection = new SPSite(ConfigurationManager.AppSettings["ServerUrl"]);
SPWeb site = sitecollection.OpenWeb("/");

SPLimitedWebPartManager mgr = GetWebPartManager(args[5].ToString(),site);
sTargetDir = args[3].ToString();

switch (args[1].ToString())
  case "import":
    Console.WriteLine("Import operation started ....");
  case "export":
    Console.WriteLine("Export operation started ....");


SPLimitedWebPartManager is one of the key classes to use if you want to manipulate webparts in SharePoint Server 2007 or WSS 3.0. (Remember that you should probably add in some error trapping...)

static SPLimitedWebPartManager GetWebPartManager(string sUrl,SPWeb site)
     SPLimitedWebPartManager mgr = null;
     SPFile file = site.GetFile(sUrl);
     mgr = file.GetLimitedWebPartManager(System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);
      return mgr;

static void ExportAllWebParts(SPLimitedWebPartManager mgr,string targetdir,WPEDataset ds)
XmlWriter writer = null;

foreach (WebPart wp in mgr.WebParts)
//Always do a flush and close of the xmltextwriter
writer = new XmlTextWriter(Path.Combine(targetdir,wp.Title)+ ".xml", Encoding.UTF8);
Console.WriteLine("Export" + wp.Title + " in zone " + wp.ZoneID);
mgr.ExportWebPart(wp, writer);

static void ImportAllWebParts(string sDirectory, SPLimitedWebPartManager mgr, string sWPZone)
string[] filenames;
string sfilename = "";
string sWPTitle = "";
filenames = Directory.GetFiles(sDirectory);
string sError = "";
System.Web.UI.WebControls.WebParts.WebPart wp = null;
XmlReader reader = null;
int i=0;

IEnumerator en = filenames.GetEnumerator();
while (en.MoveNext())
sfilename = en.Current.ToString();
sWPTitle = sfilename.Replace(".xml", "");
sWPTitle = sWPTitle.Replace(sDirectory + @"\","");
reader = new XmlTextReader(sfilename);
wp = mgr.ImportWebPart(reader, out sError);
mgr.AddWebPart(wp, sWPZone,i);

Why BPM screws up SOA ...

I saw this posting from Steve Jones - Why BPM screws up SOA and I must say that I recognize the statements being made. Especially the next one:

If you are doing BPM and then just saying "step = service" then you are doing VISUAL Cobol and replacing function calls with service. The fact that you are using WS-* or XML does not make these elements services. As the SOA-RM says "A service is a mechanism to enable access to one or more capabilities", so it is possible for it to be a single capability, but that is certainly not the only, or indeed the most likely, number of capabilities in a service.

It seems to be quite common to use the terms BPM and SOA in one phrase (see for example - Clouds on the SOA/BPM horizon? ) but are they really linked? Let me know what you think about this.

Technorati tags: , ,

Excel 2007 can now do two-way sync to a SharePoint list

Picked this up from Eli's blog:

In Excel 2003 you were able to sync amendments both from a Excel 2003 spreadsheet to a SharePoint List and from a SharePoint List to an Excel 2003 spreadsheet. But in Excel 2007 this is no longer the case...Well it was until Microsoft released an Excel 2007 Add-in.

This is a must install if you are upgrading to Office 2007 from Office 2003, otherwise your users will cry. The Excel 2007 Add-in, can be downloaded from: There is also an accompaning MSDN article "Publishing and Synchronizing Excel 2007 Tables to SharePoint Lists":

Tuesday, June 12, 2007

SharePoint 2007 Tools Collection v2

Another update:

  • SharePoint Tips Utility Pack - package of  SharePoint 2007 utilities for administrators and developers.
  • Enhanced Content Query Web Part project (beta1)
  • Microsoft IT Team Site Life Cycle Management Beta 1 - This workspace on Codeplex is intended to provide governance and manageability samples and tools designed to help IT Professionals management SharePoint Products and Technologies deployments.  Upcoming tools include an implementation of site/web lifecycle management based on the Site Delete and Confirmation feature, the Microsoft IT Site Delete Capture 1.0 feature, and additional out-of-the-box functionality.  A sample auditing configuration solution deployment package will be introduced in the September-October timeframe that provides guidance on auditing and the management of content types across site collections
  • Floating ToolPane for SharePoint 2007
  • SharePoint 2007 RSS Aggregation web part
  • Dan and Teds web part solution package template
  • Extended Content Query web part with marquee
  • SharePoint list based authentication provider - implementation of a custom authentication provider that uses a SharePoint list as its source
  • Echo for SharePoint - tool to manage customisations in a SharePoint environment and push them down to multiple sites (currently beta phase)
  • SharePoint Spy  - free tool from the guys who created Echo for SharePoint - allows you to examine  the structure of your SharePoint 2007 sites.
  • SharePoint Solution Builder tool (WSPBuilder)  
  • STP Language converter - SharePoint Site Template Language Converter enables you to convert an  Site Template that was created in one language to another language
  • SharePoint Frantic Redirection webpart - Allows you to redirect users to a specific site depending on a specific user profile property.
  • Microsoft IT Delete Capture 1.0 -
  • Chatterbox - persistent chat session for SharePoint Server 2007
  • Generic SharePoint 2007 solution installer - allows you to install and deploy SharePoint solution files using a nice UI.
  • AccRepair For SharePoint Designer - Addin for SharePoint Designer which allows you to check your MOSS sites for compliancy with compliancy regulations.
  • AccMonitor - server-side application that provides accessibility checks and which can be integrated with SharePoint Server’s content authoring workflow.
  • SPCAMLViewer - Uses SharePoint webservices to provide inside into the CAML used in SharePoint lists and views . You migth also want to take a look at similar tool CAML Builder.
  • Internet Explorer Developer Toolbar - provides a variety of tools for creating, understanding and troubleshooting web pages.  (Final Release)
  • Fiddler HTTP Debugger - Fiddler is a HTTP Debugging Proxy which logs all HTTP traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP Traffic, set breakpoints, and "fiddle" with incoming or outgoing data. Fiddler is designed to be much simpler than using NetMon or Achilles, and includes a simple but powerful JScript.NET event-based scripting subsystem.
  • Upgrade toolkit for Windows SharePoint Services - Guidance and white papers to upgrade customized site or site template to WSS 3.0
  • BDC MetaMan - Tool to generate Business Data Catalog application definition files for Microsoft Office SharePoint Server.
  • MOSS 2007 utility for import/export of user profiles - allows you to populate your SharePoint Server user profile database using basic XML files as source.
  • Cross-browser editor for SharePoint 2007 (Telerik) - RadEditor for Microsoft Office SharePoint Server 2007 (MOSS) is a cross-browser alternative to the default rich-text editor in MOSS and WSS v3. The product is developed in an agreement between Telerik and Microsoft and is provided free of charge to registered clients of SharePoint 2007.
  • MOSS Query Tool - Next version of the SharePoint Query Tool, designed for MOSS (SharePoint 2007). It has a similar feature set to the SharePoint Query Tool - it allows you to use a point and click interface to gather information such as search scopes and properties, type in search terms, and click a button to create both the search SQL syntax as well as the Xml document that is needed to run a query against MOSS. You can see results in plain text, structured Xml and now a dataset view. It supports FREETEXT and CONTAINS as well as wildcard searching. A very valuable tool for those trying to write custom SharePoint queries.
  • Forms Based Authentication Setup Helper for MOSS 2007 - Utility to ease the process of setting up and configuring Forms Based Authentication for MOSS 2007.
  • Download all documents from document library feature - allows you to generate a zipfile containing all the documents in the list and provides it as a download to you.
  • CAML.Net - Another tool which builds CAML queries dynamically in code while preserving the syntactic structure of the native CAML language. You might also want to take a look at this introducion article - Working with CAML.Net Part I .
  • Site Provisioning Assistant - Public beta - SPA provides you with centralized management for controlling how new SharePoint 2007 sites are requested and provisioned in your organization. Based on provisioning profiles that you define, users are presented with an easy-to-use interface for requesting a new site. Site requests can be associated with custom workflows that match your organization's approval process. Upon succesful workflow completion, SPA automatically provisions the SharePoint site, and notifies the requesting user.
  • SPClientUtilities feature - allows you to switch any SharePoint page into edit mode or show the Web Part toolpane
  • SharePoint Builder on CodePlex
  • SharePoint Inspector - free tool to browse your WSS 3.0 and MOSS 2007 farm. You can see objects composing its structure, get their properties by reflection, which can be very useful when you want to check if your code does what it should do.You can use also some advanced features like activate/deactivate SharePoint features, add/remove event receivers, manage your recycle bin.
  • AppPool recycler for SharePoint Devs
  • SharePoint Features Project on Codeplex - This project contacts the next features:
    • Presence Contact List v1.0: This is a contact list modified to show presence information as a drop-down associated with the e-mail field
    • Content Type Hierarchy Viewer v1.0 :This Feature presents the site content types in a hierarchical view. It shows the relationships between the content types, including hidden types. The Feature appears as the first link in the "Galleries" section of the Site Settings page.
    • Log Viewer v1.0 : This is a Feature for viewing the Unified Logging Service (ULS) logs through the SharePoint Central Administration site. It adds a new "Utilities" section to the "Operations" tab with a link to the ULS viewer.
    • Debugger feature for SharePoint - When activated, the Debugger Feature adds an “Attach Debugger” menu item to the Site Actions menu.

Saturday, June 09, 2007

Belgian Community Day

The Belgian community has a very strong reputation internationally with many individuals making their mark in their fields of expertise. Lots of individuals, like yourself, are hungry for more information about the many Microsoft products and technologies. In addition to the technical information, there is also very often the need to just socialize with other persons within the same domain of expertise.

Five belgian usergroups, BIWUG, VISUG, SQLUG, IT-Talks, and Pro-Exchange, have decided to combine their efforts to organize a joint-event just before summer starts. This event will be the biggest community event in Belgium!  So if you are eager to learn, eager to get answers to your questions and eager to socialize, come and join us for our very first Belgian Community Day.

The event will take place at the premises of SemCom in Keerbergen on Thursday, the 28th of June 2007.

So, hurry and get registered! Register on


Community Tech Preview : SDK for Open XML formats

Microsoft provides a library for accessing files with the Open XML format (this is the format that Office 2007 uses). The System.IO.Packaging namespace (part of .Net 3.0) already allows you to open these packaged files but the new SDK  goes a lot further. It is built on top of the System.Packaging API and provides strongly type classes to manipulate Open XML documents.

Dowload 2007 Office System : Microsoft SDK for Open XML Formats

If you have questions about the SDK you can use the Microsoft forums. Another interesting post about it is the one from Erika which has collected a number of links about how to programmatically create Office 2007 documents. Wouter also explains that the main purpose of the new SDK is to provide a higher-level abstraction of the Open Packaging Convention.

PS: You might also want to take a look at So what's the fuss about the new Open XML file formats?

Technorati tags: , , , ,

The devil wears Prada ... and does Unified Comms

Marijn talked about this video yesterday while we were enjoying some Belgian beers ... Take a look at The devil wears Prada ... and does Unified Comms on Soapbox. 


PS Here's some info about the original The Devil wears Prada movie as well as the book . I watched the movie and read the book - absolute no brainers ....

Thursday, June 07, 2007

SharePoint 2007 - watch out for FormUrls in a content type feature definition

The MSDN documentation - Custom information in content types talks about how you can define custom edit forms for a SharePoint content type. It specifies how you can define both FormUrls  as well as FormTemplates within a XMLDocument node for a content type - for more information take a look at the Content Type Definition Schema.

I already took a look at how to do this using FormTemplates but I thougth that it would be more straightforward using FormUrls - so I created a new content type - take a look at (Warning - the next snippet does not work correctly - read the whole blog post :-) ...)

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="">
<ContentType ID="0x0100F61D86C522AD4f189680304F14134D97" Name="CustomCT"
Description="Content type for testing custom edit forms"
<FieldRef ID="{0D3CDE70-DFAB-4411-B5D3-17DE7647BC4E}" Name="DemoComment"/>
<FormUrls xmlns="">

Well, when I tested this - the content type appeared alright but I did not see my custom edit forms. Weird ... But wait - things get worse. When I tried to deactivate the content type using the SharePoint user interface - it did not work - no errors, I just could not deactivate it. Next, I tried to deactivate it using stsadm.exe -  this did not work either. Fortunately, stsadm.exe -o uninstallfeature -name customeditform -force did work. Afterwards I reinstalled the content type feature again - just to make sure that it wasn't a temporary glitch. Then, I tried to run the next code snippet in a console application to check all installed features

SPSite sitecollection = new SPSite("http://moss");
SPWeb site = sitecollection.OpenWeb();

foreach (SPContentType ct in site.ContentTypes)
catch (SPException ex)
catch (Exception ex)


The code just stopped when it needed to enumerate the content types - when in uninstalled the CustomEditForm feature - it ran again without any problems. But wait, then I remembered that I had seen FormUrls being used in SharePoint workflows. If you take a look at the OffWfCommon feature (this is a SharePoint Server 2007 Enterprise Edition feature - you will not see it in WSS 3.0 or in MOSS standard edition)- which deploys the SharePoint workflow task content type - it does use FormUrls.

<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<Elements xmlns="">
<ContentType ID="0x01080100C9C9515DE4E24001905074F980F93160"
<XmlDocument NamespaceURI="">
<FormUrls xmlns="">

If you want to build your own SharePoint workflows using ASP.NET forms you will need to define a new workflow task content type which inherits from the default SharePoint workflow task content type and here FormUrls work without any problem.

But suppose that you still want to define custom edit forms for your content type (even when it does not inherit) - well it actually seems to work when you do it using code. So you can create a Feature event receiver in which you add your own code to manipulate the FormUrls (I'm not going into details about how to create a feature event receiver - you might want to start by taking a look at SPFeatureReceiver as well as this interesting blog post -WSS v3 solution and feature framework applied to FlexListViewer webpart). Here's a demo code snippet to register a custom edit form:

public override void FeatureActivated(SPFeatureReceiverProperties properties)
SPWeb site = (SPWeb)properties.Feature.Parent;

foreach (SPList list in site.Lists)
//If list uses specific content type then update
foreach (SPContentType c in list.ContentTypes)
if (c.Name.ToLower() == "customeditformct")
c.EditFormUrl = @"/_layouts/Dolmen/myeditform.aspx";


Important conclusion: Only use a FormUrls section within your content type when you inherit from the SharePoint workflow task content type. You can however use the EditFormUrl property allthough I still need to test this one thoroughly. If you have some feedback or experienced something similar leave a comment.

Wednesday, June 06, 2007

SharePoint Products and Technology Customization Policy whitepaper

This is an excellent guide to all possible customizations in SharePoint 2007 including real world examples and support details. Lawrence describes it as a starting point for companies to develop their own policies.

Abstract: This policy document outlines the items and processes for managing customization within an enterprise Microsoft® SharePoint® Products and Technologies hosting environment. This document begins by describing the service management concepts relating to the hosted services. It then presents information on commonly requested customizations and a few customizations that are not commonly requested, but which present significant risk to the hosted environment. Lastly it details some service policies that might affect customization planning or implementation.

Download it here

Sunday, June 03, 2007

Random thoughts (and links) on a sunday evening

I was just going over some blogposts that I flagged for follow-up the past few weeks  - there's some interesting material in there - so here you go:

Off course, you can't work (or even blog) all the time - so if you wonder what else I have been doing: