Assembly: Microsoft.Office.Interop.Outlook (in Microsoft.Office.Interop.Outlook.dll)
The GetTable method of the TableView object returns a table of items from one or more folders in the same store or spanning over multiple stores, in an aggregated view. For example, an aggregated view obtained by a search across all mail items by using Instant Search. This behavior differs from the GetTable(Object, Object) method of the Folder object, which obtains a table object that contains items from the same folder.
The parent TableView object must be based on the current folder of the active explorer, as indicated by the CurrentFolder property of the active Explorer object. If the folder is not a current folder of a visible explorer, or if the view of that folder, which is indicated by the CurrentView property, is not a table view, Outlook returns an error.
The filter for the resultant table is set by the Filter property of the TableView object. If the Filter property of the TableView object is not empty, GetTable returns a Table object with rows that represent the filtered subset of items available in the view. If subsequently, the Restrict(String) method is called on the resultant table, applying the Restrict method is equivalent to a logical AND operation with the filter represented by Filter.
GetTable returns a Table with the default column set. GetTable does not return a Table that contains columns for each field in the ViewFields collection of the current view. For more information on the default column set of a table based on the folder type, see Default Properties Displayed in a Table Object. To modify the default column set, use the Add(String), Remove(Object), or RemoveAll() methods of the Columns collection object. Properties that you cannot add to a table as columns are listed in Unsupported Properties in a Table Object or Table Filter.
The order of rows in the resultant table is not guaranteed to be the same as the order of items in the current view on which GetTable is based. For example, GetTable does not return a table with a row that represents a group-by header in the view. To sort the rows in the table returned from GetTable, use the Sort(String, Object) method of the Table object.
The parent object of the Table object returned by GetTable is the TableView object. The parent object of the TableView object is the Views collection, and the parent object of the Views collection is the Folder object.