Monday, December 17, 2007

List Template Types

We have been discussing various parts of features and solutions and how you can use them to efficiently build your SharePoint business solution. One of the most basic things is to create a list template that instances can base themselves on. To begin your list template feature you need to create a ListTemplate element. This element has many attributes that define your list. One of the most important of these is the Type attribute. In the MSDN documentation it states that this is

"Optional Integer. Provides a unique identifier for the template. This identifier must be unique within the feature, but need not be unique across all feature definitions and site definitions. It then lists the built in template types and the type of list that they correspond to:

100 - Custom List
101 - Document Library
102 - Survey
103 - Links List
104 - Announcements List
105 - Contacts List
106 - Events List
107 - Tasks List
108 - Discussion Board
109 - Picture Library
110 - Data Sources
111 - Site Template Gallery
113 - Web Part Gallery
114 - List Template Gallery
115 - XML Form Library
120 - Custom Grid for a list
200 - Meeting Series List
201 - Meeting Agenda List
202 - Meeting Attendees List
204 - Meeting Decisions List
207 - Meeting Objectives List
210 - Meeting Text box
211 - Meeting things to bring list
212 - Meeting Workspace Pages List
300 - Portal sites list
1100 - Issue Tracking
2002 - Personal Document Library
2003 - Private Document Library

It then states that this value corresponds to the Type attribute of the List element.

We have been having some problems with this actually working, though. We built out some lists using the Visual Studio extensions for WSS and we wanted to place some list event receivers on a specific list. Well according to the extensions you should be able to do this by adding the event receivers to the .cs files for that list instance. We tried that and the event receivers were on every custom list. So we poked into the XML for the list instances and found that all of them were using type 100 or (Custom list). So we tried changing them to a different numbers in the 800 range, such as 800, 801, 802, etc. When we tried to deploy the new solution and check the list we received an HRESULT error, which most people know are some of the most unhelpful errors you can get in SharePoint. So we changed the numbers back and then re-deployed and the lists worked fine again.

The documentation says that it needs to be a unique integer across the feature. All of ours were and yet they did not work. If anyone has more insight as to how these list templates really work, feel free to leave a comment explaining them.

Labels: , , ,

Sunday, December 16, 2007

Release of SP1 for WSS 3.0 and MOSS 2007

Finally the release of SP1 for WSS 3.0 and MOSS 2007 is out! There are many hotfixes rolled into this service pack as well as some new functionality and stsadm commands. You should read the following post about how to apply the service pack.

Labels: , , ,

Use the Tools that are Available

As I said in a previous post, building features and solutions can be pretty time consuming and manual. At one point I believed that it would take nearly half of the development time of a project to create the features and solutions to deploy the project to a production environment.

That was until I found tools that help speed and ease custom development for SharePoint. One of these tools is the SharePoint Solution Generator. If you download the Visual Studio extensions for WSS this tool comes as part of the package. This tool allows you to create your custom lists and sites using the UI and then run the utility to pull those customizations into feature XML and list and site templates. You can then take these generated Visual Studio projects and build a solution that can e deployed to a production server, or staging area. This also helps to make sure that your project deploys the way you want it to.

The next tool is the Visual Studio extensions for WSS 3.0 or (VSeWSS). This extension to Visual Studio aids in building features and solutions. It adds new project templates such as List Definition, Blank Site Definition, and Web Part. These templates will generate the feature.xml and elements.xml files for you and populate them with some of the items you need to create a list or site. The extensions also allow you to build a solution from the project and deploy it to a site.

I did find some limitations in the 1.0 version of the extensions that really limit what types of projects you would be able to use them for. You are not able to modify the manifest.xml file for the solution so this limits adding template files and additional assemblies.

With these limitations I did not think I could use the extensions for the project I was working on until I found that there was a CTP of the 1.1 version of the extensions. This was greatly improved over the 1.0 version. You can now modify the manifest.xml file and there are additional templates to help speed your development. These include the Content Type, List Definition from Content Type, Template, and Module templates. Pretty much anything you can do with features and solutions, you can now do with the Extensions. There are still a couple of limitations to them that should be fixed by the release version. These are, that if you add code files to the project they will not be built into the solution unless you add a event receiver to the project. Another is that there is no way to deploy files to the _layouts folder, yet. They promise this in the release version. Also the features have the GUIDs appended to their names, but this will be removed by release time.

I find this version to work well for many of the project types that I have and will definitely speed up my SharePoint development life cycle.

For additional information on the extensions and how to use them:

Chris Johnson's Blog
Chris O'Brien's Blog

Labels: , , , , ,

Monday, December 10, 2007

Who are you Inherited From?

While working on a new SharePoint project recently, the issue of how best to package the list instances, content types, and site columns to deploy them to a production site cam up. The first time we tried to use Features and Solutions to deploy SharePoint lists, let's just say, was kind of a disaster. We ended up destroying all of the built-in base content types and having to reinstall MOSS on the development server.

This time around I was determined to figure out how to use Features and Solutions to deploy these items. In the next few posts I will describe how I used new tools available to ease this development and the issues I cam across while using Features.

The first problem that I attempted to solve was the inheritance of content types. In our project we had a Request content type that inherits from the base event type. This Request type was then going to be inherited by other content types that I was going to develop and then eventually applied to a list. The first problem I had was the lack of good documentation on the MSDN about content types and how to inherit them. I started to look at some blogs and it seemed that everyone was using a different method and having it work.

I eventually settled on a system that worked. It began by realizing that there are two types of content types - site content types and list content types. Site content types are created at the site level and can be applied to multiple list instances. List content types are an instance of a site content type that is applied to a specific list. This allows you to set a column as hidden or change the order of the columns for a specific list without modifying the site content type.

Once I figured this out the documentation made a little more sense. I ended up creating the Request content type inherit from the base event content type through the "00" + hexadecimal GUID inheritance method. So to inherit from event the content type would look like 0x010200AB1294....continue 32 GUID digits. The ox represents the system type, the 01 the base item type and the 02 the base event type. You then divide your GUID with "00" as a separator. You then append a GUID to make a unique content type identifier.

For the content types that inherit from the Request type you can use the "A0" two hexadecimal digit method for content type inheritance by taking your content type ID for the Request type and appending two hexadecimal digits to it.

This worked well for me in my inheritance project.

To create a list content type for a list instance, I then took my content type ID and using the "00" + hexadecimal GUID method created a unique ID for the list version of the content type.

Another interesting thing with content types and list content types in list instances is that you need to include all of the fields in the list definition as well as the content type in order for the columns to show up in the list instance.

Some of the links that I used for for content types are:

http://msdn2.microsoft.com/en-us/library/aa543822.aspx

http://msdn2.microsoft.com/en-us/library/ms479905.aspx

This second link is the generic link about content types. There is a lot of information here about content types, it just isn't as thorough as it could be.

In the next post I will discuss some new tools to speed development of Features and Solutions.

Labels: , , , ,

Thursday, December 6, 2007

PerformancePoint Server Training

Currently I am taking the PerformancePoint Server - Applications training in preparation for retaking the beta exam for PPS. The training has been very comprehensive and was able to answer some of my questions as to how PerformancePoint and SharePoint are integrated.

As for SharePoint stuff, the next few posts will include more detail about Features and building out Content Types as I am back into the mire that can be Features. I have found some new tools that also help in the creation of Features and Solutions that make the development of them much easier.

Additional upcoming topics include creating a custom field type and rendering it, using Feature Receivers, and some clarification of how content type inheritance really works.

Labels: , , , ,