The Ultimate SharePoint Discussion Board Customization

Problem:

  1. User wants to be able to receive email notifications from SharePoint Discussion Board.
  2. User should be able to start & reply threads via email, using his Outlook or mobile phone.
  3. Ideally, replies should go into the Correct Topic Folder and new threads should create a New Topic Folder in SharePoint Discussion Board.

At first, I thought “Dude, this is Microsoft. They must have think about this functionality”. So I accomplished Problem Number 1 using SharePoint Alert feature. For Problem Number 2, I used the Incoming Email feature in List Settings. Done?

No.

You see, if you use the Alert feature, SharePoint sends the email from the email you configure in Central Admin. What this means is that when user hits reply, they now have to remember the Discussion Email Address configured in List Settings Incoming Email !

Just for fun, I cheekily asked the business user, “What’s wrong with that? You will always remember our hostname after @, and just give a short-name for the alias before @”  😀

Of course I get the reply, “Not acceptable. Find a solution. This is Microsoft product, if lacking the feature, clearly there should be 3rd party solutions out there that fill the gap.”

So I went on a 1-week research about Discussion Board add-ons. I had a look at Lightning Tools; their Social Squared supports emailing threads, but alas it’s built on top of SQL Database, meaning a separate web app, not a SharePoint solution. Their Storm Forum is based on SharePoint list, but according to the feature matrix, no email support. Kwizcom has another SharePoint solution, but again, no email support 🙁

What does this mean? That means I gotta code my own SharePoint customization. Yay! My technical heart pumps in excitement. Not so for the people who depended on me for other stuff: “How long will it take you to implement this custom solution?” 2-3 weeks I estimated. 3 days it took me. And now that I will give you the solution, 1 day for you oh readers 😀

Let me give you a peek of what this customization can do:

Outlook Conversation View after Discussion Board Customization

SharePoint Discussion Board web view

 

 

 

 

 

 

 

 

 

From the screenshots above, you can see that I accomplished Problem no. 3 too: showing emails in Threaded View. This is no easy feature. After dissecting Microsoft.SharePoint.dll using ILSpy, I finally discovered the class SPDiscussionEmailHandler.cs. In that file, there is a method named GetFolder() that retrieves the folder of the Discussion Topic.

The above code shows that when receiving Incoming Email, SharePoint decides a reply is part of the same Topic Thread if:

  1. It has the same Thread-Topic and Thread-Index email headers
  2. The RelevantMessages column of ListItem contains the original Message-ID of the Topic Folder.

I thought I could accomplish this by using Thread-Topic and Thread-Index, but Outlook strangely removes the Thread-Topic email header when I clicked Reply!

Thankfully there is that 2nd option using the RelevantMessages field 😀

So finally, lo and behold below is the Custom Event Receiver that you should attach to List Template ID of 108 (SharePoint Discussion Board List)

Leave a comment if you like this solution 😀

Reader Comments (15) on “The Ultimate SharePoint Discussion Board Customization

  1. Hi Zeddy,

    Thanks for your wonderful article. it was a great releif to have a custom feature so that the discussion can sit on the correct thread whenever they are getting Created/Replied from email.

    I used the above feature. i have few questions about it.
    when I create a new item from the Discussion board (NOT Email) itself or reply to an existing discussion from Discussion board (NOT Email), the message id and thread index is giving exception
    messageId = item[“MessageId”].ToString();
    OR
    messageId = parentItem[“MessageId”].ToString();

    what is your thought about it.

    Regards,
    Yogendra

    • @yogendra: hi Yogendra, strange, I am never getting MessageID null. Further creating new posts replying via Web will immediately hit the code without waiting for SPDiscussionEmailHandler to finish first. Set breakpoints on your ItemAdded event receiver and see what happens (remember it is not ItemAdding).

  2. Hi,

    I”m a bit late at the party, but I do have a question:

    Can this be used to reply to sharepoint discussion threads using ANY e-mail client/webmail so long as the e-mail address is linked to a registered sharepoint user with rights to post into the respective thread?

    Thanks in advance!

    • @andrew: Yes, I tested using iPhone, BlackBerry, Windows Phone and Outlook. As long as you click reply without modifying the email headers the replies will be threaded automatically in SP2010.

  3. Great article Zeddy.

    As the previous poster noted, I know I’m a bit late to the thread. Your thread is one of the de facto posts on how to do this, and I hope it still fits in your day to be able to reply to comments.

    I’m replying to discussion board via Yahoo and Gmail web interfaces. To me, it seems both change the Message-ID and both are also stripping the Thread-Index and Thread-Topic headers.

    Have you had any success with these means of replying and/or know how to get them to work?

    Thanks in advance.

  4. Hi,
    Nice article.
    Can we send the entire reply along with the one newly added reply in the thread through email, and is there anyway to attach attachments ?

    Thanks
    Ravish

  5. Hi I have implemented this in one of my works for discussion works like magic.. but i found out that when user edits the topic subject from the SP UI then it creates a new thread from reply mail

  6. hi I’m quite new to sharepoint. Could you leave a few helpful links that could guide me, so I can follow your post step by step?

  7. Thank You. Great article. Very useful and saved lot of time.
    You achieved Problem #3 using custom event receiver, but how you solved problem #2 (User should be able to start & reply threads via email, using his Outlook or mobile phone.)

    “If you use the Alert feature, SharePoint sends the email from the email you configure in Central Admin. What this means is that when user hits reply, they now have to remember the Discussion Email Address configured in List Settings Incoming Email!”

    How users reply back to an email address configured in Discussion Board (Incoming Email), when they received an email alert from different address?

    Regards,
    Arkay

  8. Super late to the party….would this work for discussion lists from categories?..It’s part of the community set from sharepoint 2013

Leave a Reply to nazish ali Cancel reply