Category Archives: sharepoint

SharePoint Service Pack 1 released!

Today Microsoft released the 2007 Microsoft Office servers Service Pack 1 and the 2007 Microsoft Office servers Language Pack Service Pack 1 (whew, what a long title… ;)). Although it contains fixes for all the Office System products, I’m mostly interested in the SharePoint 2007 (i.e. WSS 3.0 and MOSS 2007) Service Packs. We’ve been waiting some time for them now…

Joel Oleson did the official announcement. Here are some direct links to the goodies:

Before you install the service packs you might want to visit the SharePoint Products and Technologies Service Pack 1 Resource Center and read this and this.

SharePoint Content Deployment and Migration API Deep Dive

Here a quick post which could be regarded as a note to self, since one of my current projects involves migrating SharePoint content 🙂

Recently I stumled on an interesting series of blog posts written by Microsoft employee Stefan Goßner about the SharePoint Content Deployment and Migration API.

Here are the links to the articles:

I don’t know if Stefan is planning on writing more articles in this series, but I know I’ll be monitoring his interesting blog from now on…

Cool e-book: The Web Part Infrastructure Uncovered

The Web Part Infrastructure Uncovered coverA while ago I did some proofreading for Teun Duynstee‘s e-book The Web Part Infrastructure Uncovered. I found it a very good read. In fact I think it is one of the most thorough books available on the subject, even though it only has 135 pages. This e-book has been available for some months now, but since I just recently started blogging I thought I might spend a blog entry to it. With SharePoint 2007 now using the .NET Framework 2.0 Web Part technology as one of its core technologies, knowledge about this framework has become more and more important.

Teun sells his book online through The price is €14.00 (ca. $17) for the printed book (+ shipping & handling) or €9.00 for the downloaded PDF (ca. $11) which is peanuts considering the book’s useful content.

I recommend this e-book to every .NET developer that’s working with or interested in Web Parts. You can check out some sample chapters here and here.

Generating GUIDs in the Visual Studio IDE

If you’re programming on Windows you’ll often come across a situation where you have to generate a new GUID. In fact I find myself generating new GUIDs more than ever! I used to use them only for COM/ActiveX and Windows shell integration stuff. Nowadays however I spit out several GUIDs a day, especially for projects involving WiX and SharePoint. In fact, I tend to use them everytime I need a unique identifier. Here’s one I’ve generated especially for this blog post:

{1B87C5E2-0818-4c21-ADFC-741E8D8C1B3D} 😉

The classic tool of choice for generating GUIDs is ofcourse GuidGen.exe, which ships with all the major Microsoft SDK’s and can also be started from the Tools menu of Visual Studio. GuidGen is a small tool which gets the job done, but somehow I have never gotten used to it. I don’t like the fact that I have to leave the Visual Studio IDE to use it and that I cannot control the output format of the GUIDs GuidGen generates. For instance when using WiX you need to use GUIDs without the accolades, which means that a GUID generated by GuidGen needs some editing before it can be used. Yawn…

In the past I was a pretty avid Borland Delphi programmer. One of the nice things of the Delphi IDE, and one that I used very often, was that you could press the keyboard shortcut <ctrl> + <alt> + G and it would place a fresh new GUID at the cursor’s position in the source code editor. I really missed this functionality in Visual Studio.

Fortunately Visual Studio can be easily customized using macro’s and it was easy hacking together a little macro that does the job. I’ve used it for several years now and shared it with many colleagues and friends. Here it is:

Sub Create_GUID()
    Dim sel As TextSelection
    sel = DTE.ActiveDocument.Selection
    sel.Text = System.Guid.NewGuid.ToString("D").ToUpper()
End Sub

Just add this macro to Visual Studio and assign it to the keyboard shortcut of your choice. I use <alt> + G, since the original Delphi shortcut I mentioned above is already in use by Visual Studio by default (it point to the Debug.Registers function).

Ofcourse you can easily modify this macro to suit your personal needs. If you like the way GuidGen bakes ’em, here it is:

Sub Create_GUID
    Dim sel As TextSelection
    sel = DTE.ActiveDocument.Selection
    sel.Text = "{" + System.Guid.NewGuid.ToString("D").ToUpper() + "}"
End Sub

Or maybe you prefer underscores instead of hyphens:

Sub Create_GUID
    Dim sel As TextSelection
    sel = DTE.ActiveDocument.Selection
    sel.Text = Replace(System.Guid.NewGuid.ToString("D").ToUpper(), "-", "_")
End Sub

Or you might be a lower-case fanatic:

Sub Create_GUID
    Dim sel As TextSelection
    sel = DTE.ActiveDocument.Selection
    sel.Text = System.Guid.NewGuid.ToString("D").ToLower()
End Sub

Anyway, I think you get the point…

Splitting a Virtual PC VHD

Two weeks ago me and some colleagues attended the U2U course Developing Microsoft SharePoint 2007 Solutions Part 2: Advanced, led by the legendary Jan “SmartPart” Tielens. I can recommend this course to everyone interested in SharePoint development. It’s filled with interesting topics and it was put together by the also legendary Patrick Tisseghem. During the course we had to practice the stuff we had learned by going through several hands-on labs. For this U2U provided us with a Virtual PC virtual hard disk image (VHD), that contained a complete SharePoint 2007 developer environment (Windows Server 2003, WSS 3.0, MOSS 2007, Visual Studio 2005, SQL Server 2005, Office 2007 etc.).

A couple of days ago, back at our office, me and my colleague Harmjan had some spare time and wanted to practice some of the hands-on labs from that course. Unfortunately the hard drive of my Harmjan’s laptop didn’t have enough free space to contain the U2U course VHD, which is about 11GB in size. He did however bring his brandnew iPod, which still had plenty of free disk space. So he asked me to copy the VHD to his iPod, so he could run it from there.

To my surprise the file copy operation failed! As it turned out Harmjan’s iPod was formatted with the FAT32 file system. One of the main limitations of this file system is, that the maximum size of a file you can put on it is 4GB (well, it’s 232-1 actually…). That meant the U2U VHD would never fit. Ofcourse I could have reformatted the iPod to NTFS, but since an iPod’s firmware doesn’t support this file system it would mean the iPod couldn’t be used as an iPod anymore.

So there had to be an alternative approach. I remembered I had once encountered a situation where a VHD was splitted into several smaller chunks. I searched for this behaviour in the Virtual PC help file and found this:

In some situations, Virtual PC might automatically split a virtual hard disk file into smaller files because of file-size limitations imposed by the host operating system. For example, if the virtual hard disk is stored on a FAT32 volume of the host operating system, it is split into multiple 4GB files.

So this was it! We just had to find a way to split the U2U VHD into several smaller chunks (each less than 4GB). But how to do it? As far as I know Virtual PC has no option to split an existing VHD into smaller chunks. The Virtual Disk wizard only supports this process in the opposite direction, i.e. merging several VHD chunks into one big VHD. I searched the internet, but didn’t find a solution. I did encounter several posts of people who had asked this question before. One of these posts was located on Ben Armstrong’s Virtual PC Guy blog. Unfortunately, from the comments on that post I concluded even he didn’t seem to have an answer. I still sent him an e-mail, asking how to do it, though.

While waiting for a reply from Ben I got bold and downloaded a copy of the official VHD specs from Microsoft. Maybe I could hack together a little tool that would do the job. The only information I could find about splitted VHD’s was this:

Versions prior to Microsoft Virtual Server 2005 supported splitting of disk images, if the disk image grew larger than the maximum supported file size on the host file system.

Some file systems, such as the FAT32 file system, have a 4-GB limit on file size. If the hard disk image expands more than 4 GB, Microsoft Virtual PC 2004 and previous versions will split the hard disk image into another file. The split files do not have any headers or footers, just raw data. The last split file has the footer stored at the end of the file. The first file in the split disk image has an extension of .vhd. The following split files use the .v01, .v02, … filename extension. The split files will be in the same directory as the main hard disk image. The maximum number of split files that can be present is 64.The size of the split file cannot be altered.

There it was! As it turns out a split VHD is nothing more than a normal VHD, chopped up into smaller chunks. No extra headers or footers, just a raw file splitting operation. I couldn’t believe it was this simple.

So I quickly downloaded a copy of the popular HJSplit file splitting utility and split the U2U VHD into several chunks, using a maximum chunk size of 3.5GB (I could have used a larger chunk size, but I wanted to be on the safe side). I then renamed the chunks, so they matched the pattern required by Virtual PC (i.e. U2U.vhd, U2U.v01, U2U.v02, U2U.v03, …). I copied the chunks to the iPod and created a new Virtual PC instance (.vmc), that used the newly, splitted, VHD. And guess what… It worked! I experimented with several other chunk sizes and it doesn’t really seem to matter what chunk size you choose.

I immediately notified Ben Armstrong of my findings and in his reply he said he too was surprised this approach had worked. By now he has already spoken to his colleagues at the Microsoft virtualization team and they confirmed that splitting VHD’s this way is safe and he said he planned to blog about this sometime in the near future.

Well, this concludes my first real blog post. It got a little longer than I had expected, but I hope you found it a good read.