Asked by:
Outlook 2010 issue. Drag-n-drop onto a custom task pane causes Selection.Count to grow

Question
-
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
UserControl1.vbPublic 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),
Andrei Smolin
Add-in Express Team LeaderMonday, September 26, 2011 3:12 PM
All replies
-
Monday, September 26, 2011 6:07 PM
-
Hi Eric,
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
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.
Thursday, September 29, 2011 9:02 AM -
I was never given a Connect link, as I don't think the Outlook team ever files anything there. I was told that it's a known issue. You can follow up with Teresa Thomas if you like.
Eric Legault
MVP (Outlook)
About me...Thursday, September 29, 2011 2:57 PM -
Hi Eric,
Thanks for your clarify.
Have a good day,
Tom
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.
Friday, September 30, 2011 3:14 AM -
Hello everyone,
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),
Andrei Smolin
Add-in Express Team Leader
Please mark answers and useful posts to help other developers use the forums efficiently.Monday, March 26, 2012 3:54 PM