Scott Hanselman

New Outlook VSTO AddIn: How to disable Reply To All and Forward in Outlook 2007

August 21, '08 Comments [6] Posted in Source Code | Tools
Sponsored By

2010 UPDATE: Gavin has released an updated version of his No Reply To All Add-In on the Microsoft Research Site. Go get it free!

Last October I posted a Macro-quasi-hack to Disable Reply To All and Forward in Outlook within your own company network. The technique uses a macro to flip a metadata bit in a message.

Of course the only REAL way truly to disable Reply to All and Forward is to use IRM (Intellectual Rights Management) in Outlook 2003/7. However, this technique was useful to a lot of people as it is super simple and can stop those "knee-jerk" Reply to Alls.

Anyway, after this post Gavin Smyth of Microsoft Research emailed me and said:

"However, it's still such a useful idea that I finally got round to writing a C# addin to do it (vaaaassst overkill, I know, but it was easy) - toggle buttons (one for reply, one for forward) on the ribbon that set the two flags appropriately."

Cool. He's written his first Visual Studio Tools for Office (VSTO) AddIn, and it's a good tutorial on how to write one!

image The general idea os:

  • Start with the VS Outlook Add-In project wizard
  • Add the ribbon group & buttons
  • Create click event handlers for both, replicating what was in your my blog posting

Poof. Package and Deploy. It's really obscenely easy. Actually, way easier than the macro way I did it.

Now my Messages have these nice shiny new icons:

NoReplyButtons 

The source is trivial:

using System;
using Microsoft.Office.Tools.Ribbon;
using Outlook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;

namespace NoReplyAllAddin
{
public partial class Ribbon : OfficeRibbon
{
public Ribbon() { InitializeComponent(); }

private bool SetActionFromButton( object sender, object context, string action )
{
bool oldValue = false;
Outlook.Inspector inspector = context as Outlook.Inspector;
if( inspector != null )
{
Outlook.MailItem msg = inspector.CurrentItem as Outlook.MailItem;
if( msg != null )
{
oldValue = msg.Actions[ action ].Enabled;
RibbonToggleButton btn = (RibbonToggleButton)sender;
msg.Actions[ action ].Enabled = !btn.Checked;
}
}
return oldValue;
}

private void OnClickNoReplyAll( object sender, RibbonControlEventArgs e )
{
SetActionFromButton( sender, e.Control.Context, "Reply to All" );
}

private void OnClickNoForward( object sender, RibbonControlEventArgs e )
{
SetActionFromButton( sender, e.Control.Context, "Forward" );
}
}
}

You can download the setup and/or the source for Gavin's "No Reply for Outlook 2007"  over at his Software Utilities site. Thanks to Gavin!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Thursday, August 21, 2008 9:42:00 PM UTC
Very slick. I installed and plan to start using it. I especially like that the icons look nice.

Just a thought: I wonder how difficult it would be to also disable the Forward/ReplyAll buttons in the main Outlook window (when using the reading pane instead of opening the message in a new window). The buttons are still enabled, although they give a message ("action not available for this item").
Thursday, August 21, 2008 10:13:20 PM UTC
Ok, i don't get it! Can only i use this or can i send emails to people with it attached and it will stop them forwarding it in Outlook? Or am i missing something?
Will
Thursday, August 21, 2008 10:28:16 PM UTC
Will - If you send someone inside your Exchange server an email, and they are also using Outlook, this will disable their Reply To All and Forward functionality, just for that message. They don't have to have this installed.
Friday, August 22, 2008 3:53:23 PM UTC
This is AWESOME!!! I can't tell you how many times I wished I could just stop people from replying to all. Next time the idiot train starts up at work, I think I will try to 'reply to all' with 'reply to all' disabled and see if I can cause the train to stop :).

Thanks for the awesome find.
Rich Denis
Sunday, August 24, 2008 9:10:49 PM UTC
Hi Scott,

Yep, ReplyAll is a scourge of most teams - it's killing email (well, certainly for most people using it for work). The trouble is sometimes people would like the choice of seeing the conversation.

Given that problem, we're trying to do something about it with 'another way' rather than 'on or off', and building on what we did with Taglocity 1.0 (you kindly spoke about it here). To get an idea of the vibe then there's a video to watch which gives the high level overview.

As we have some Taglocity Groups in use at Microsoft then give us a shout if you want to play with it, you'll be most welcome - we're in closed beta but in fact anyone that mentions that they read your blog I'll make sure gets in.

PS Did I shill, I think I might of, but it was kinda relevant :-)

PPS See you at PDC this year?
Thursday, September 04, 2008 5:20:54 PM UTC
Scott,

Thanks for the addon is there a version available for outlook 2003?
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.