Row object (Outlook)
Represents a row of data in the Table object.
A Table is composed of rows and columns. It represents a read-only dynamic rowset of data in a Folder or Search object. You can regard each row of a Table as an item in the folder, and each column as a property of the item. By default, the Table contains only a subset of properties for items in the folder. This makes the Table an in-memory lightweight rowset that supports fast enumeration and filtering of items in the folder.
Use Row.GetValues to obtain an array of values that correspond to column values at that row in the Table.
Use the helper functions Row.BinaryToString, Row.LocalTimeToUTC, and Row.UTCToLocalTime to facilitate type conversion of column values at a specific row. For more information on property value representation in a Table, see Factors Affecting Property Value Representation in the Table and View Classes.
Although additions and deletions of the underlying folder are reflected by the rows in the Table, the Table does not support any events for adding, changing, and removing of rows. If you require a writeable object from the Table row, obtain the Entry ID for that row from the default EntryID column in the Table and then use the GetItemFromID method of the NameSpace object to obtain a full item, such as a MailItem or ContactItem, that supports read-write operations. For more information on default columns in a Table, see Default Properties Displayed in a Table Object.
The following code sample illustrates how to obtain a Table object based on the LastModificationTime of items in the Inbox. It also shows how to customize columns in the Table, and how to enumerate and print the values of the corresponding properties of these items.
Sub DemoTable() 'Declarations Dim Filter As String Dim oRow As Outlook.Row Dim oTable As Outlook.Table Dim oFolder As Outlook.Folder 'Get a Folder object for the Inbox Set oFolder = Application.Session.GetDefaultFolder(olFolderInbox) 'Define Filter to obtain items last modified after May 1, 2005 Filter = "[LastModificationTime] > '5/1/2005'" 'Restrict with Filter Set oTable = oFolder.GetTable(Filter) 'Remove all columns in the default column set oTable.Columns.RemoveAll 'Specify desired properties With oTable.Columns .Add ("Subject") .Add ("LastModificationTime") 'PR_ATTR_HIDDEN referenced by the MAPI proptag namespace .Add ("http://schemas.microsoft.com/mapi/proptag/0x10F4000B") End With 'Enumerate the table using test for EndOfTable Do Until (oTable.EndOfTable) Set oRow = oTable.GetNextRow() Debug.Print (oRow("Subject")) Debug.Print (oRow("LastModificationTime")) Debug.Print (oRow("http://schemas.microsoft.com/mapi/proptag/0x10F4000B")) Loop End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.