If you would like to discuss anything, please contact me via email: Howard.Bayliss@sequence.co.uk

Thursday, February 24, 2011

SharePoint "The Product ID specified was not found"

Today I started the installation of a 4 server farm. The SharePoint 2010 setup media had been copied into a network folder location. I chose to copy that folder to all of the SharePoint servers, so that the setup program would run locally, rather than come across the network.

On each SharePoint server I ran the setup program and installed the prerequisites. This worked fine.

On one server, I then tried to install the main SharePoint program files but I got the following message: "The product ID specified was not found on the machine", as shown below.

Oddly this acutally worked on one of the servers, but for the other 3 it failed.

I can only assume that copying the setup folder to each server had somehow corrupted the files. Anyhow, the solution was instead to mount an ISO image as an optical drive on all servers, and that worked.

Monday, February 21, 2011

SharePoint Solution and Authored Artifact Development

Microsoft produced a useful article regarding designers and developers working together on SharePoint projects (albeit it's for MOSS, not SharePoint 2010).

However, the article does leave an unanswered question, which I address below.....

Based on the Microsoft article, our approach is this:
  1. All developers and designers have their own virtual machine, running an independent SharePoint farm.

  2. All assembly and artifact development takes place within Visual Studio - SharePoint Designer is not used.

  3. Team Foundation Server (TFS) is the only repository for source code.
We like this approach because:
  1. We can comply with ISO standards for source-control.

  2. Master Pages and Page Layouts are deployed in an uncustomised state.

However, consider this scenario: Developer A needs to create a content roll-up which rolls-up content from a deep site structure. In order to create the roll-up, Developer A needs to create all of the content on their own farm. Once they've checked-in the roll-up code into TFS, other developers can use the roll-up in their farms, but only after they have re-created the site structure - and that could take a long time to create.

In addition, suppose Developer A creates a roll-up that targets a particular list (by the list GUID). How do you ensure that the list is created with the same GUID on all farms?

What's needed is an easy way for content to be replicated between all of the farms.

There are several possible solutions to this:

  1. Back-up the content database in one farm and restore it to all of the other farms. This is not ideal as the process would delete any work-in-progress-content that a developer had created for their own use.

  2. Use SharePoint's built-in Content Deployment process. This will distribute newly created content between the farms, and doesn't have the "delete" issue described in the last point. However, as we mostly work with SharePoint Publishing sites, we have an issue in that you can only deploy content to a Publishing site collection that has not already had a site definition applied. This means you need a "master" farm, where all content is created, and from where content is deployed. This is not an ideal situation when you have multiple developers who need to create content and test locally on their own farm.

  3. Use "stsadm -o export" to package content to a file, which can be re-imported into another farm. This is our preferred method as it avoids the issues listed above. Exported file packages can be put into a shared folder or TFS, depending on your requirements.

Friday, February 18, 2011

SharePoint failed to retrieve field value

Issue: The Associated Content Type of a page layout is shown as "failed to retrieve field value".

After packaging and deploying some new page layouts, I went to the home page of a site collection and tried to put the default page into edit mode.

The following page error appeared: "Value does not fall within the expected range".

The stack trace wasn't very helpful. However, when I looked at the "Master Page" gallery using the Site Content and Structure tool, I noticed the issue described above. Here is a screen shot, with the problem highlighted in yellow:

I went back to the module definition for the page layout and compared it with some others in the same file.

The error was caused because of a missing # symbol, which should have preceeded the content type reference. This is shown below, again with the issue highlighted:

Thursday, February 10, 2011

LoadControl() Request failed

I was tearing my hair out over an issue with using the UserControl.LoadControl method from within SharePoint, which kept throwing this exception:

Exception Details: System.Security.SecurityException: Request failed.

We run our code using the least priviledge possible, which means creating a custom CAS policy. However, no amount of tweaking the CAS policy seem to fix the issue.

It seems this is a common issue (see this blog post). People who have commented on that blog suggest a number of solutions. However, I found the only solution was to:
  1. Call the LoadControl method from an assembly located in the GAC.
  2. Use the PermissionSet Assert method to obtain sufficient privileges
Here is an example of the code:

public static Control LoadControl(UserControl parentControl, string controlName)
Control control = null;

System.Security.PermissionSet permissionSet = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted);

string controlPath = String.Format("~/_controltemplates/{0}", controlName);
control = parentControl.LoadControl(controlPath);

return control;

Friday, February 4, 2011

Content controls have to be top-level controls in a content page

I made a change to a page layout to include a CSS file and started seeing an error message which said "Content controls have to be top-level controls in a content page".

This is how the markup looked; can you see the error?

<asp:Content contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">


<SharePointWebControls:CssRegistration name="/_layouts/1033/styles/Themable/search.css" runat="server" >


Did you spot the error?

The CssRegistration declaration was missing its closing tag. Once fixed, the page worked correctly.

Wednesday, February 2, 2011

I Love SharePoint - Mug

Being a SharePoint fanatic I had to get hold of an "I Love SharePoint" mug. Fortunately such mugs do exist and here is a picture of mine:

If you want to buy one yourself, you can order them from this site.