A couple errors that came up in the SharePoint 2010 Developer Training Kit

I’ve started to go through the SharePoint 2010 Developer Training Kit after setting up a development environment and I received a couple error messages while doing the Labs.

While trying to add a custom webpart to a webpart zone:

“Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.”

While attempting to debug a project:

“Could not load the Web.config configuration file. check the file for any malformed XML elements, and try again. The following error occurred: The given key was not present in the dictionary.”

Both of the errors were resolved by ensuring  the URL assigned to the Default zone for the Web Application’s Alternate Access Mappings matches the Site URL of the SharePoint project in Visual Studio 2010. Using one of the other zones (like Intranet) for the URL will not work. The Default Zone and the project’s Site URL need to match. Thanks to Steve!

Customizing SharePoint workflow emails in 2010/Foundation

Part of the migration process to SharePoint 2010 or Foundation is ensuring that everything is working as perscribed. One thing that I had a little trouble with was customizing the format of workflow emails from the plain or basic one to something more stylish like the out of the box alert format. With Wss 3.0 and 2007 you could write html code and paste it into the body of the ‘Define E-Mail Message’ dialog, the issue there was that you had to remove all html whitespace from the code. See Create Custom E-mail Alert Templates for SharePoint Workflows for a handy tool that will help you create the html.

I had hoped that there would be a better way to define the email template in Foundation / 2010 but after some google’n nothing came up. So I attempted to do the same as with Wss 3.0. Created my html with the handy tool above, pasted it into the body and updated the Lookup fields. Tested. No Good, no formatting took and the email just contained the code. Then I noticed the properties dialog of the email step in the workflow:

Selecting the Properties in the dropdown give you this:

I noticed here that something was up with the body of the email, it had tons of additional html along with the code I pasted into the body:

After re-pasting the html code into the String Builder the workflow email had the correct formatting. Also any further changes to the body I made in the normal email dialog worked too. Now if there was a way to have the whitespaces?