OL2002: Selection Collection Empty If Grouped Items Selected (294556)



The information in this article applies to:

  • Microsoft Outlook 2002

This article was previously published under Q294556

SYMPTOMS

When you implement the Selection collection in a custom Outlook solution, the collection does not contain grouped items if the user clicks the group header in an Outlook view.

CAUSE

This is a limitation of the Outlook object model.

MORE INFORMATION

If you group items in a view, you can then click the group header. Although the items are not visibly selected in the view, you can then perform operations that affect all of the items in the group. For example, if you press DELETE, all of the items in the group are deleted.

In the Outlook object model, the Selection collection contains the items in a folder that are currently selected. However, the collection does not contain items if their corresponding group header has been selected.

Steps to Reproduce the Problem

  1. Create a view that groups items based on a particular field. To do this, make sure that you are using a table-based view, click Group By Box on the Advanced toolbar, and then drag an appropriate field from the column heading to the Group By Box bar.
  2. Within the grouped table view, click the group header bar.
  3. Run the following Outlook Visual Basic for Applications subroutine:
    Sub SelectionHeader()
       MsgBox Application.ActiveExplorer.Selection.Count
    End Sub
    					
The result is zero.

REFERENCES

For additional information about available resources and answersto commonly asked questions about Microsoft Outlook solutions, click the article number below to view the article in the Microsoft Knowledge Base:

287530 OL2002: Questions About Custom Forms and Outlook Solutions


Modification Type:MinorLast Reviewed:3/1/2004
Keywords:kbpending kbprb KB294556