简体   繁体   English

Outlook 2010 DragDrop Bug

[英]Outlook 2010 DragDrop Bug

I have an Outlook 2010 Add-In where the user drags and drops emails on a TreeView or ListView . 我有一个Outlook 2010 Add-In ,用户在TreeViewListView上拖放电子邮件。 To get these emails I am using the following code: 要获取这些电子邮件,我使用以下代码:

Outlook._Application myOlApp = new Outlook.ApplicationClass();
Outlook.Selection droppedMails = myOlApp.ActiveExplorer().Selection;

The problem is if the user selects for example three emails the droppedMails will have three emails, but after the first selection if he selects one, the droppedMails will be four. 问题是如果用户选择三个电子邮件,则lostMails将有三封电子邮件,但在第一次选择之后如果他选择一封,则lostMails将为四封。

My question is why myOlApp.ActiveExplorer().Selection is not cleared the second time? 我的问题是为什么myOlApp.ActiveExplorer()。选择不是第二次清除? do I have to release Outlook objects? 我必须发布Outlook对象吗?

EDIT: 编辑:

The email preview in Outlook also stops working. Outlook中的电子邮件预览也停止工作。 So every selected email after drag and drop doesn't change the preview. 因此,拖放后每个选定的电子邮件都不会更改预览。

The problem will be solved when the user clicks on another folder in Outlook. 当用户单击Outlook中的另一个文件夹时,问题将得到解决。

Thank you for your time. 感谢您的时间。

After some research I found that the problem is that the dropped emails COM objects aren't being released. 经过一番研究后,我发现问题是掉线的电子邮件COM对象没有被释放。 The easiest way to release them is to call the e.Data.GetData("RenPrivateMessages"); 释放它们的最简单方法是调用e.Data.GetData("RenPrivateMessages"); method after finishing the drag and drop logic in the DragDrop Event Handler . 完成DragDrop Event Handler中的拖放逻辑后的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM