Hello,We have an issue reported by our customer. I reproduced the issue in the project described below.The project. The project is downloadable here, file size = 16 969. This is an Outlook 2010 add-in project in VSTO 2010. The code in ThisAddin.vb:
Public Class ThisAddIn Private WithEvents explorer As Outlook.Explorer Private ctp As Microsoft.Office.Tools.CustomTaskPane Private Sub ThisAddIn_Startup() Handles Me.Startup explorer = Application.ActiveExplorer() ctp = Me.CustomTaskPanes.Add(New UserControl1(), "Title") ctp.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight ctp.Visible = True End Sub Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown Me.CustomTaskPanes.Remove(ctp) System.Runtime.InteropServices.Marshal.ReleaseComObject(explorer) End Sub Private Sub explorer_SelectionChange() Handles explorer.SelectionChange Dim selection As Outlook.Selection = explorer.Selection System.Diagnostics.Debug.WriteLine("!!! selection.Count=" + selection.Count.ToString()) Dim res As Integer res = System.Runtime.InteropServices.Marshal.ReleaseComObject(selection) System.Diagnostics.Debug.WriteLine("!!! res=" + res.ToString()) End Sub End Class
Public Class UserControl1 Private Sub UserControl1_DragEnter(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragEnter e.Effect = Windows.Forms.DragDropEffects.All End Sub Private Sub UserControl1_DragDrop(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragDrop End Sub End Class
InitializeComponent in UserControl1.Designer.vb:
<System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.SuspendLayout() ' 'UserControl1 ' Me.AllowDrop = True Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.Name = "UserControl1" Me.ResumeLayout(False) End Sub
The issue. Start Outlok 2010 SP 1 32-bit. In the explorer window, drag an item onto the custom task pane; you may be required to drop one more item. Now start selecting items and check the selection.Count. The result: selection.Count grows while you select new items. The expected behavior: selection.Count should return the number of items actually selected in the explorer.In my tests, the Navigation pane was Normal, the To-Do Bar was Normal, the Reading pane was Off.Note. If the Reading Pane is shown, it freezes after drag-n-drop. Because we reported the Outlook team about Reading Pane freezing after drag-n-drop in Outlook 2010 32-bit a while back, the current issue seems to be just another manifestation of the same bug. However, I didn't test the current issue in Outlook 2010 64-bit, sorry.
Regards from Belarus (GMT + 2),
Add-in Express Team Leader
Would you please share the Connect link for us? It will be very beneficial for all of the community members who interesting in it to track the process of it.
Have a good day,
Tom Xu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
We've found a solution for this problem. Find a shared add-in project demonstrating the solution in Outlook, custom task pane and drag-drop problem on the Add-in Express blog.
Regards from Belarus (GMT + 3),
Add-in Express Team Leader
Please mark answers and useful posts to help other developers use the forums efficiently.