_Explorer.RemoveFromSelection Method
Cancels the selection of the specified Microsoft Outlook item in the active explorer.
Namespace: Microsoft.Office.Interop.Outlook
Assembly: Microsoft.Office.Interop.Outlook (in Microsoft.Office.Interop.Outlook.dll)
Syntax
'Declaration
<DispIdAttribute()> _
Sub RemoveFromSelection ( _
Item As Object _
)
'Usage
Dim instance As _Explorer
Dim Item As Object
instance.RemoveFromSelection(Item)
[DispIdAttribute()]
void RemoveFromSelection(
Object Item
)
Parameters
Item
Type: System.ObjectThe item to be removed from the selection.
Remarks
The selection in the active explore is represented by the Selection object that is returned by the Selection property.
To be removed, an item must be selectable in the current view of the active explorer. Use the IsItemSelectableInView(Object) method to determine whether the item can be selected in the view. The item does not have to be visible in the view.
Under the following conditions, Outlook returns an error when you call the RemoveFromSelection method:
The specified item is not in the current view of the active explorer.
The specified item is being edited in the current view of the active explorer.
The current view has been filtered and the application of the filter removed the item from the view.
The specified item has not been saved.
The specified item represents a StorageItem.
The current view is a conversation view.
No current view exists for the active explorer.
If the item is selected, calling RemoveFromSelection causes the SelectionChange event to fire. If the item is not selected, calling RemoveFromSelection will not cause the SelectionChange event to fire.
Calling RemoveFromSelection does not scroll the view to make the selected item visible in the view and does not expand or collapse groups in the view.
The following table illustrates the results of calling RemoveFromSelection, taking into consideration any current selection (the Count property), whether the Reading Pane is displayed, and whether the specified item is displayed in the Reading Pane.
Existing Selection.Count |
Reading Pane Displayed |
Specified Item Displayed in Reading Pane |
Results |
---|---|---|---|
1 |
Yes |
Yes |
|
>1 |
Yes |
No |
|
>1 |
Yes |
Yes |
|
>=1 |
No |
N/A |
|
If the specified item exists in the current view but is not selected in that view calling RemoveFromSelection does not result in any change to the selection and the SelectionChange event does not fire.
When you specify an item in a recurring appointment or task as an argument to the RemoveFromSelection method, make sure that before you pass the argument, you obtain an instance of the occurrence by first expanding the recurrences, using the IncludeRecurrences property and the Items collection. If you do not expand the recurrences and obtain an occurrence in the series, you would be passing an instance variable that represents the appointment or task series, and the RemoveFromSelection method would be operating on the series instead of the occurrence.