Who is Rich Haddock?

I was recently working on some new blog topics and a possible white paper when I stumbled across this little bit in SharePoint 2010. If you have worked in-depth with SharePoint publishing then you will undoubtedly be familiar with the Reusable Content capabilities within SharePoint. So, when playing around with Reusable Content in SharePoint 2010 I found this:


As you can see… SharePoint 2010 ships with three pieces of reusable content out of the box. Now I can understand the copyright and the quote but when I saw the Byline I immediately had to ask myself the question that I doubt anyone else cares about:

Who is Rich Haddock?

Admittedly this is a silly question and one that proves that my Sunday afternoon was a little slow… but sometimes you run across something like this and just want to find the answer. That and it gave me the opportunity to blog about something a little less serious.

Thanks to the wonders of search engines and the Internet there is no longer such a thing as privacy or anonymity (the pros and cons of this reality is a discussion for another time). According to Wikipedia, Rich Haddock served in the Royal Navy around the late 1600’s… probably not our guy. A little more digging brings up a LinkedIn profile and Twitter profile… looking promising. Apparently there was a Rich Haddock that worked at Microsoft from 1999 to 2009 but not specifically on the SharePoint team. Still; sounds like our guy. At the time of this post I had contacted the most likely Rich to see if he could shine some light on the situation… so we’ll see if that goes anywhere.

Now, there is a second part to this journey. Whenever I run into something in SharePoint that leaves me guessing I like to reverse engineer the product to have a better understanding things. If Rich responds to me then maybe I’ll know the why but what about the how? This leads me to our second part…

How did this sample data get there?

I started by doing a GREP over the 12 hive for the word “Reusable” using the AstroGrep tool. This revealed that the PublishingResources feature has a new CustomUpgradeAction called “ReusableContentExamples”. Great! But now that means that we’ve got to jump into the code because CustomUpgradeActions are designed to call custom code whenever the feature is upgraded (just like a feature receiver except on upgrade rather than activate). We can use the ReceiverAssembly and ReceiverClass on the UpgradeActions element to find our next stop.

Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
Microsoft.SharePoint.Publishing.PublishingResourcesFeatureHandler

So I load up the 14 root and dig into the ISAPI folder to pull out the above DLL. At this point you’re going to want to get the file into Reflector so that we can see what’s going on inside. Once you’ve got the DLL disassembled and take a look at the FeatureUpgrading method on the above class you will see a reference to the RootProvisioner.CreateReusableContentExamples method call. Now we’re on to something. Digging further into that method we find that Microsoft has written custom code to populate the Reusable Content List whenever the feature is upgraded. The important excerpts are below:

...
string bylineTitle = Resources.GetString("ReusableContentBylineExampleTitle");
...
CreateReusableExampleListItem(list, bylineTitle, Resources.GetString("ReusableContentBylineExampleHtml"));
...
list.Update();
...

Ok so we know that the Reusable Content List is being populated by the PublishingResources feature using a CustomUpgradeAction which executes custom code in the Microsoft.SharePoint.Publishing assembly. This code adds items into the Reusable Content List by grabbing the title and body HTML from the resources files. We could easily stop here but now that we have come this far let’s go ahead and find these resources files as well…

If we take a look at the Resources class constructor we see the following:

static Resources()
{
    resourceAssembly = Assembly.Load("Microsoft.SharePoint.Publishing.intl, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c");
    resourceManager = new ResourceManager("Microsoft.SharePoint.Publishing.Strings", resourceAssembly);
    resourceBrandStringManager = new ResourceManager("Microsoft.SharePoint.Publishing.BrandStrings", resourceAssembly);
    resourceAssemblyDM = Assembly.Load("Microsoft.Office.DocumentManagement.intl, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c");
    resourceManagerDM = new ResourceManager("Microsoft.Office.DocumentManagement.Intl", resourceAssemblyDM);
}

Ok… one step closer now let’s pull the Microsoft.SharePoint.Publishing.intl DLL out of the GAC and also bring it into Reflector. Open up the Resources folder on the DLL and view the Microsoft.SharePoint.Publishing.Strings.resources file. Sort alphabetically and jump down to “R” and here’s what we find.

I'm a public speaker and the Chief SharePoint Architect for Eastridge, a Microsoft Gold Partner specializing in SharePoint and custom application development in Winston-Salem, NC. I focus on the SharePoint platform with a specialty in Information Architecture, Publishing and Best Practices.

Got something to say? Go for it!