Wednesday, 1 July 2009

MOSS Deployment

If you have a deployment job that hangs in the running state where it had previous failed then try this:

on source and target please do the following:

Open Central-Admin - Operations - Timer Job Status.

Choose "Service" for the "View"

Select "Central Administration" for the Service

Can you find a Content Deployment timer job?

If not, then the job is indeed no longer running.

In this situation you can change the status to Failed manually to allow restart:

Browse to http://central-admin-url/Lists/Content%20Deployment%20Jobs

choose the list item related to the job that shows the incorrect status

edit the job and change the "LastStatus" field to "2" which means Failed.

Now you can restart the job manually using the manage content deployment paths and jobs page.


Thanks to Stefan Go├čner

Tuesday, 16 June 2009

Intro to Pex and TDD

I need to work on the presentation for the dev team at work and have the samples and presentation from the Pex site but am not sure which code samples to use or to mix in some work code?

Do I include Contacts and Stubs as well or would that be to much for a 2 hour session?

Friday, 5 June 2009

Pex Explorations

So after last night I decided to break out a couple of methods for testing from the main project.

and running Pex generate unit tests gave me the following

and added

Thursday, 4 June 2009


Didn’t get as much done as I would have liked. Though one thought did cross my mind why do VS templates not conform to things like StyleCop  and R#

Must admit though I like Pex as it helps create tests I think I might need to pick a fresh project to add it to.

Do take the time to read through the documentation and the slide decks are good for teams.

Wednesday, 3 June 2009

First pass at Pex

I have a class that I need to serialize out for remoting which has information about an order with addresses, payment details and order items.

This object will be sent to a message queue and deserialized before process into out MS Dynamics Nav database.

The first thing I did was download the latest version of Pex and get the class to build. Once this was done I ran the Pex explorations and encountered an error ‘failed to generate project CSharp\Test\’ the post explains about file path lengths and how to get passed this. It’s a bit confusing here as this was my home machine and it’s not difficult to move solutions around but I think it my be more tricky on the dev box at work where paths can be long as projects can be nested quite deeply. This has also caused Reshaper to throw exceptions as well so it is something to watch out for.

So what happened next – well everything went smoothly and Pex found that I was missing an entry in my app.config. True – i had copied the code over but not the solution so I had missed the app.config even though everything built. A .stubx file is built by default for the class under test.

It is worth pointing out that I had seen previous demos of Pex at DDD7 and read through, though so far not in great detail the documentation.

I’ll go through the other tests tomorrow.

Tuesday, 2 June 2009


Just run the Bowling Game application created to run unit tests from the TDD book and used Pex to create parameterized unit test stubs and it creates a .stubx for each of the classes. Wondered how each class had to be stubbed out.

Monday, 1 June 2009

Stubs and Pex

Should have paid more attention to the ‘Getting Started’ document where it mentions that Stubs only supports mocking of Interfaces and abstract methods.

Friday, 29 May 2009

Pex 0.13 Released

Pex 0.13 Released with this release and some new project work I’m going to try and use Pex to create tests. Should be interesting as I’ve got to test webservices and serialization for messaging.

Friday, 22 May 2009

MOSS 2007 SP2 Expiration Issue

MOSS SP2 Expiration Issue there is an issue where the expiration date on an SP2 updated server will as they say “During the installation of SP2, a product expiration date is improperly activated. This means SharePoint will expire as though it was a trial installation 180 days after SP2 is deployed. The activation of the expiration date will not affect the normal function of SharePoint up until the expiration date passes. Furthermore, product expiration 180 days after SP2 installation will not affect customer’s data, configuration or application code but will render SharePoint inaccessible for end-users.”

How’s that for an issue!!!

Thursday, 14 May 2009

401.1 Unauthorized access

Our Infrastructure 'guru' has advised that, the IE7 update be removed and the registry entry be deleted while he investigates it further.

Tuesday, 12 May 2009

401.1 Unauthorized access

IE7 Security Update KB963027

After installing this update IE7 stopped authorizing access to sites on our MOSS 2007 SP2 box. Unistall this update and it allows access.

If you leave the update in place (recommended) I found method 2 worked;en-us;896861

Host Headed Site Collections

Running through the creation of host headed site collections and deployment can be frustrating at times as there doesn't seem to be much documentation out there.

Our environment is an application/source server sitting within our domain and a WFE farm out in the DMZ. All content is sent to the WFE by content deloyment.

Create a standard publishing site on the application server with the required host header. Then with the stsadm createsite command with the values for the host header site collections - you can add the sitetemplate to the createsite command or login to each site and set the template from there.

Create a host headed blank site on the WFE and a blank site collection. Then with the stadm createsite command create the host headed site collections.

stsadm -o createsite -url hostheadedurl-owneremail owneremail-ownerlogin ownerlogin-hhurl rootsiteheadedurl-title sitetitle-sitetemplate BLANKINTERNETCONTAINER#0

[There are other options that can be set]

It was at this point that I found an issue where, if I used the STS#0 template as the sitetemplate the deployments later would not run. Login to each site and pick the blank site template and accept the permission defaults.

On the application server - content deployment - create a path from the root site collection to the root site collection on the WFE. You'll need to create a path for each of the host headed site collections and then create a job for each one.

Don't forget, as I did the first time round, to add the host headers onto IIS and either have them registered on your DNS or add them to the hosts file.

Edit: I forgot to mention that AAM will have no entries for these host headed site collections. You can add a flag to create the site with it's own content database if you need (maybe easier for the DBA to control)

Tuesday, 17 March 2009

StyleCop Update

An update for StyleCop was released on March 13. After removing the previous version and installing the new one I had to rerun the StyleCop for Resharper addin. (v4.3.1.3 released March 13, 2009) (0.0.14317.000 released March 14, 2009) (haven’t tried this)

Wednesday, 4 March 2009

Adding Metadata to a MOSS 2007 Publishing Portal pt2

Add three columns to the Content Type that you use for WCM. In this example I've used PageTitle, PageDescription and PageKeywords.

Add the assembly to the Master Page and reference the MetaData dll
<%@ Register TagPrefix="metaControl" Namespace="MetaData.Render" Assembly="MetaData.Render, Version=, Culture=neutral, PublicKeyToken=198d2f392e054e3e" %>

Example: In the head
<metaControl:SharePointMetaTag runat="server" ID="metaTag1" MetaName="DESCRIPTION" MetaAttributeName="Content" PublishingPagePropertyName="PageDescription" DefaultAttributeContent=""/>

The DefaultAttributeContent is where the editor has not completed the field as we've made them non manditory

namespace MetaData.Render
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
// using System.Linq;
using System.Security.Permissions;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

/// A webpart to render MetaData information onto a published page

[ParseChildren(false), ToolboxData("<{0}:MetaTag runat=\"server\" name=\"\"> "), PersistChildren(true),
AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal),
AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal),
public class MetaData : WebControl
/// Name to render out

private string name;

/// Initializes a new instance of the MetaData class.

public MetaData() : base(HtmlTextWriterTag.Meta)

/// Gets or sets the Tag name to render out

[Bindable(true), Category("Appearance"), DefaultValue(""), Description("Sets the MetaTag's name attribute.")]
public string Name
get { return; }
set { = value; }

/// Render the control

/// Render this writer
protected override void Render(HtmlTextWriter writer)
// Render control only if there is a tagname specified
if (!

/// Add attributes to Render

/// The writer to add the attributes to
protected override void AddAttributesToRender(HtmlTextWriter writer)
// Write the name attribute

// Write the value attribute
StringWriter sw = new StringWriter();
base.RenderContents(new HtmlTextWriter(sw));
writer.AddAttribute("value", sw.ToString());

/// Render the content out

/// The writer to be rendered
protected override void RenderContents(HtmlTextWriter writer)
// this control does not render any contents

Thursday, 26 February 2009

Adding Metadata to a MOSS 2007 Publishing Portal

I found a way of adding MetaData to each page within a public facing website. There are still discussions on whether it is of any value, as some search engines don't always read it, to change the description and keywords.

In the Content Type(s) that the pages use add three fields - one for page title that will appear in the browser and will not affect the title used for the .aspx and in menus, one for the description as for some reason the description added when the page is created is not used (though I don't know it is crawled and returned in search results) and keywords.

I didn't add these fields to the page layout as there are lots of pages for our Marketing department, who own the content, to redo.

I'll post up the rest of the code tomorrow as I don't have the code at home.

Friday, 13 February 2009

Create custom 404 in MOSS 2007

We had an issue where our new site had the same Url as the old one and Google search results were returning the old one which was no longer visible (Url pointing to new IP address) the above link is to the Microsoft Knowledge Base article for a solution. It worked for us.

Tuesday, 10 February 2009

Entity Framework

Finally got the EF to install!! It appears that VS2008 did not have SP1 and non of this was picked up on the updates. Once installed the DataModeller appered

Monday, 9 February 2009

Entity Framework Tests

Just a quick one – guess I was being an idiot (no change there then). I was creating a couple of tests for my entity model and got an error

"The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid."

A little bit of searching revealed that I needed an app.config for the test project with the connection settings for the model – makes sense but was confusing at first.

Entity Framework

Had some problems, and still do, installing the Entity Framework on my home laptop. At one point after un-installing 3.5 SP1 and the updates VS2008 decided that it would also delete all my templates.

Tuesday, 27 January 2009

IE8 RC1 Released

It has been announced that IE8 has gone to RC1. See the notes for known issues

Wednesday, 21 January 2009

Content Deployment Manifest Reader

I found this tool from Maxime Bombardier about troubleshooting content deployment issues along with a link to an excellent tool for debugging the manifest file to see where the content deployment is failing.

Thursday, 15 January 2009

Remote debugging

I was looking at a way to get remote debugging working for debugging MOSS custom webparts from an VS2008/XP PC to the Win2003 server running MOSS.

The section “The Remote Debugging Monitor is the one accepting your debug calls and the talking back to Visual Studio on your client, so to get these things to work you have to start the client as the user running Visual Studio (or have administrative permissions on the client). You can either log in to the remote host using that user or, as I prefer, right-click on the msvsmon.exe and choose Run As... Make sure that the user you are using to run the monitor with is member of the local Administrators group.” was a ‘gotcha’ that I missed first time round.

Do remember that when you attach to the w3p process during debugging it will prevent other users on MOSS from performing any actions.

Ted Patterson Free Webcast

Introduction to SharePoint 2007 Development Using Features and Solution Packages Instructor: Ted Pattison Date: January 20, 2009 Time: 1 - 2 PM EST Price: FREE!

In this one hour seminar, Ted Pattison will give you a jumpstart into the world of SharePoint development and explain how Features make it possible to design and implement reusable business solutions. Ted will also show you how to develop Features using a Visual Studio 2008 project as well as how to build a solution package which will enable you to deploy and to update your Features in a production environment using best practice techniques. Register today at

Tuesday, 13 January 2009