vsto 启用 禁用加载项
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!
2010更新:Gavin在Microsoft研究站点上发布了他的“对所有加载项均不答复”的更新版本。 去免费获得!
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.
去年10月,我发布了一个宏准黑客程序,以在您自己的公司网络内的Outlook中禁用全部答复和转发功能。 该技术使用宏来翻转消息中的元数据位。
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.
当然,真正禁用全部回复和转发的唯一真正方法是在Outlook 2003/7中使用IRM(知识产权管理)。 但是,这种技术非常简单,它可以阻止很多“下跪的人”回复所有人,因此对很多人都有用。
Anyway, after this post Gavin Smyth of Microsoft Research emailed me and said:
无论如何,在这篇文章发表之后,微软研究院的Gavin Smyth给我发了电子邮件,说:
"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."
“但是,它仍然是一个非常有用的想法,我终于回过头来编写一个C#插件来做到这一点(我知道这很简单,但是很容易)-在功能区上切换按钮(一个用于回复,一个用于转发)适当地设置两个标志。”
Cool. He's written his first Visual Studio Tools for Office (VSTO) AddIn, and it's a good tutorial on how to write one!
凉。 他已经编写了他的第一个Visual Studio Office for Office(VSTO)插件,这是一个很好的教程。
The general idea os:
总体思路os:
- Start with the VS Outlook Add-In project wizard 从VS Outlook加载项项目向导开始
- 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.
of 打包和部署。 这真的很容易。 实际上,它比我做的宏方法容易得多。
Now my Messages have these nice shiny new icons:
现在,我的消息中有这些漂亮的闪亮新图标:
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!
您可以在他的“软件实用程序”站点上下载Gavin的“ Outlook 2007无回复”的设置和/或源代码。 感谢加文!
vsto 启用 禁用加载项