Поделиться через


Discussion Boards and Content Types

My last night in Seattle/Redmond. I have one day left of SharePoint 2010 Developer Ignite training and I am wiped out. What better time to crank out a blog post.

I received an interesting email from a customer not too long ago regarding Discussion Boards. In a nutshell (and names changed to protect the innocent) here is what the business user was looking for:

“I would like to set up one discussion board capable of capturing multiple content types, like Unplanned Event, Equipment Problem, etc.  Each content type would have a common group of columns, like created by, created on, last modified, subject, description, etc.  Each would also have additional columns which are specific to the content type.  For instance, Unplanned Event might have columns for event start/end date and time, event type, corrective actions taken, etc.  Equipment Problem might have columns for equipment location, trouble-shooting performed, abnormal running conditions, etc.  Each content type would likely have a different work flow.

The subject view of the discussion group would display all entries, regardless of content type.  This view would display some of the common columns and probably be ordered on last modified date.  Viewing/editing forms would display all columns, including the content type specific columns.  Each entry would allow replies to be added.”

Now, I’ve done a lot of work with discussion boards in the past, but more around basic capabilities. I’d never had a request come in for this type of solution so I never peeled back the onion to see how content types are configured. I was surprised to find out that by default multiple content types are allowed for this list type. There are two content types available on the list. The first content type, ‘Discussion’, is the default. It inherits from the folder content type. This is the only type of content you can create from the ‘New’ button (despite default settings below). The second content type is ‘Message’. This content type can only be created by clicking the ‘reply’ button on the form.

image

So in Essence, the Discussion content type is just a fancy folder. When a user creates a discussion and views this, the list has a special out-of-box view. Part of that view is that users can click “reply”. This basically creates a new list item based on the message content type. This new item is placed ‘under’ the Discussion list item. All this is wired up natively.

So what’s the answer?

My customer originally went down the path of creating a new content type, inheriting from discussion (which inherits from folder) and adding site columns. When my customer attempted to add this content type to the discussion board the ‘enhanced discussion’ content type could not be found. It turns out that the discussion board is picky as to what content types it allows. The folder content type is not on the list. And my feeling was that even if you could get around this with code, there would still be several issues. First, you’d need to address making the ‘reply’ button unique for each ‘enhanced discussion’ content type with custom logic. Second, you’d have to handle the custom capabilities in the views settings. The list goes on.

image

Option 2

So what was the answer? Well based on the architecture of the out-of-box discussion group list definition my personal recommendation was to use multiple discussion groups to achieve the desired results. In the end I think it’d be far easier to manage and customize using the built in SharePoint methods. This would allow a team to easily add metadata columns to each discussion group list through the web admin. Plain and easy.

The only challenge with this configuration is the roll-up view. The requirements state “the subject view of the discussion group would display all entries, regardless of content type.  This view would display some of the common columns and probably be ordered on last modified date.  Viewing/editing forms would display all columns, including the content type specific columns.”

This could be accomplished a number of ways including content by query web part, data view web part, or a custom web part. All in all, much easier than the prospect of hacking things through the UI, or writing code, or creating a new discussion list definition.

There are always multiple ways to accomplish something in SharePoint and I’m not suggesting it’s not possible to create a list with multiple discussion/message content types, but my opinion is that it will take a lot more work to do this, and a lot more customization than the approach I describe above.

Are there any other creative approaches to handling the above requirements in SharePoint? Add your thoughts!

Comments

  • Anonymous
    September 22, 2009
    Interesting post Nate... have you had a chance to see if the discussion forums in SharePoint 2010 are any better than the relatively archaic ones found in WSS 3.0 and MOSS 2007?

  • Anonymous
    September 23, 2009
    The comment has been removed

  • Anonymous
    October 15, 2009
    Interesting topic Nate. I am now facing a problem about discussion board customization, I need to add a button to every reply and append some logic behind it.I think is very silimar with 'making reply button unique' in option 1, but I have no idea how to do it. Can you please shed me some lights? Thanks, Jeffrey

  • Anonymous
    October 18, 2009
    Hi Jeffrey, I advised against option #1. In theory you could create a view though, and then open that new page in SharePoint Designer. That'd be the first thing I'd try. But for an extra button you're probably getting into customizations using Visual Studio. Check out the SharePoint Server SDK from www.msdn.com. Sorry I can't help more. Regards, Nate