我正在使用c#outlook插件。 如果发件人地址是什么,我如何阻止回复或转发呢?
答案 0 :(得分:1)
捕获MailItem.Reply / ReplyAll / Forward事件。所有这些参数都有Cancel(by ref)参数,你可以设置为true。
答案 1 :(得分:0)
你应该使用VBA宏。
检查此链接: http://www.hanselman.com/blog/HowToEasilyDisableReplyToAllAndForwardInOutlook.aspx
显然,也可以通过interops获得对ActiveInspector的访问..ActiveInspector.CurrentItem.Actions("Reply").Enabled = False
ActiveInspector.CurrentItem.Actions("Forward").Enabled = False
答案 2 :(得分:0)
我一直在寻找一种方法来创建一个电子邮件并禁止回复并使用c#回复所有函数用于Visual Studio项目。我遇到了你的问题,但你标记的答案对我不起作用。以下是我所寻找的,我希望它可以帮助其他人寻找类似的东西:
Outlook.Application oApp = new Outlook.Application();
//Create new email
Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
//Set recipients here
Outlook.Recipient oRecip = (Outlook.Recipient)oMsg.Recipients.Add(myRecipientsVariable);
//Check to make sure they're all valid recipients in my contact list
oRecip.Resolve();
//Stop recipients from being able to reply all
oMsg.Actions["Reply to All"].Enabled = false;
//Stop them from being able to reply
oMsg.Actions["Reply"].Enabled = false;
//Set the Subject line
oMsg.Subject = "Test Subject Line";
//Tidy Up
oRecip = null;
oMsg = null;
oApp = null;
基本上是message.Actions [] .enabled = false;位。我相信这将适用于任何2013年及更晚的展望。
-Cheers