Archive for September, 2007

Can’t find that newly saved list template when creating a new list?

Ever came across that situation where you just saved an existing list as a template? And then you tried creating a new list based on that template? No matter how hard you looked, you just couldn’t find the template saved earlier when trying to create a new list?

Chances are that your list was provisioned using a feature and that the Hidden property of the <ListTemplate> element was set to True. That property prevents the list template from showing up on the page where you create a new list. Unfortunately, this also makes it a little bit more difficult to create that list through the SharePoint user interface.

Yes, I said a little more difficult, not impossible. There happens to be a work-around that allows you to still perform that action through the UI. This little trick was inspired on something that worked in SharePoint Portal Server 2003 as well. Sometimes the UI doesn’t allow you to perform a certain action (for example, it hides the action). However, the page that performs the actual action, could be fooled in performing the hidden action, by passing the correct query string parameters.

In this case, we will do exactly the same thing to create our list. Navigate to the site where you want to create your list and go to View All Site Content. On that page, click the Create button. As you already found out, the template you just saved isn’t here. Now, click the link to create a new Custom List.

Notice the address bar in your browser. The new.aspx page takes a FeatureId and ListTemplate as a parameter. The FeatureId parameter matches with the feature which installed this list on the SharePoint environment. The ListTemplate parameter probably speaks for itself; it specifies the template ID of the list.

To create a list based on a saved template, you need to specify an additional parameter to new.aspx. This parameter is called NewPageFilename and its value should be the name of your STP file.

Now you should look up the feature that installed the list you’re trying to create and copy its ID. Take this value and replace the value for FeatureId in the query string. Also, look up the <ListTemplate> element that is defined in the feature and copy its Type attribute. This value corresponds with the ListTemplate parameter in the URL, so replace the value in the query string with the value you just copied.

When you’re done, your URL should look something like this (without the square brackets):

/_layouts/new.aspx?NewPageFilename=[YourTemplateName]%2Estp&FeatureId={735DE88F-B6C1-4571-8D5F-08BF22D6CF40}&ListTemplate=130185

There you go! This URL should allow you to create your list. Navigate to the URL above and fill out the form like you normally do and you’re done :) This trick probably also works with hidden lists that don’t have a saved template. In that case, just omit the NewPageFilename parameter.

SharePoint hotfix 939077 partially breaks Advanced Search

Microsoft released a hotfix package for SharePoint Server 2007 and for SharePoint Server 2007 for Search. This hotfix package fixes an issue where sites that use forms-based or cookie-based authentication are not being crawled in SharePoint. It also fixes an issue where slow performance of the BLOB cache is experienced. The latter is the reason why we installed this hotfix on the production environment of a client I’m currently working at.

The hotfix addresses the issues just fine. However, on our environment it appears to be introducing a new issue: It breaks the out of the box SharePoint Advanced Search Box web part with the following dreaded error: “Object reference not set to an instance of an object.” 

This is all the information you’re getting, no stack trace, nothing in the logs. This pretty much left me clueless. At first I thought I screwed something up with my own search settings. That feeling got stronger after I created a default Search Center site: the Advanced Search web part was still working there.

After some puzzling I concluded that it had to be a difference in the web part properties, since it appeared to be working on the default Search Center site. So I exported both web parts, and examined the differences…and indeed, the only differences where property settings.

Right, back to my non-working version of the web part. In my version I was hiding the Properties section which is visible in the default web part. After making it visible on my web part again, it worked! So much for testing your hotfixes before rolling them out…

The problem is definitely the hotfix. I also installed it on my development environment and it broke the Advanced Search web part as well…

The hotfix cannot be uninstalled, so now we’re pretty much waiting for the hotfix-hotfix from Microsoft. For now, I guess I’ll just have to remove the Advanced Search web part from the search results page.