Dev4Side OpenSource Projects

Easy WebPart Type ID generator

This project is a very a simple GUI for a method posted into MSDN's SharePoint Development
http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/a0fc0978-0d55-463a-b7ab-72c00aee76a3

It solves a problem related to the database attach method when migrating from SharePoint 2007 to SharePoint 2010.
Before perfoming a database attach to migrate a content database in SharePoint 2010, you should always run the powershell command *Test-SPContentDatabase* to generate a report which will underline issues during the migration.

The problem is that missing SharePoint WebParts are indicated throght an GUID that is not intuitive to obtain.
This ID is called WebPart Type ID and is generated whith the concatenation of the full assembly name + '|' (pipe symbol) + full type name of the WebPart, converted to a byte array using Unicode encoding, and hashed using the MD5 provider.

This is the implementation posted by Vancek in the forum:

// thx to: VanceK
string data = tbAssembly.Text;
data += "|" + tbTypeName.Text;
byte[] dataBytes = Encoding.Unicode.GetBytes(data);
MD5 hashAlgo = new MD5CryptoServiceProvider();
byte[] hash = hashAlgo.ComputeHash(dataBytes);
Guid hashGuid = new Guid(hash);
tbResult.Text = hashGuid.ToString();

This tool allows you to generate your own WebPart Type ID, allowing you to locate missing webparts.

Form

As you can see Assemblies and Type names can be located by navigating to http://YOURSERVER/_layouts/newdwp.aspx

HowTo

Source code and binaries can be found on CodePlex at the following url:

CodeplexLogo