Outlook) (行对象

代表 Table 对象中的数据行。

备注

表 由行和列组成。 它表示 文件夹 或 搜索 对象中数据的只读动态行集。 该文件夹,并且每一列视为项目的一个属性中的项可将一个 表 的每一行。 默认情况下, 表 中包含的文件夹中的项目属性的子集。 这使得 表 支持快速枚举和筛选文件夹中的项目的内存中的轻量行集。

如果 Table 对象是从 Folder.GetTable 获取的,则可再指定一个筛选器(在 Table.Restrict 中)来获取 Table 中一组限制更多的行。

使用表方法 FindRow、 FindNextRow、 GetNextRow 和 MoveToStart 获取 表中的特定行。

使用 Row.GetValues 以获取数组中的值对应于 表 中的行的列值。

使用 Row.BinaryToString 、 Row.LocalTimeToUTC 和 Row.UTCToLocalTime 的帮助程序函数以便在特定行的列值的类型转换。 有关 Table 中的属性值表示方式的详细信息,请参阅影响 Table 类和 View 类中属性值表示方式的因素。

虽然基础文件夹的添加和删除 表 中的行反映,但 表 不支持添加、 更改和删除行的任何事件。 如果需要 表 中的行从一个可写对象,从默认条目 Id 列在 表 中获得行条目 ID,然后使用该 命名空间 对象的 GetItemFromID 方法来获取完整的项目,例如 MailItem 或 联系人 ,支持读写操作。 有关 Table 中的默认列的详细信息,请参阅 Table 对象中显示的默认属性。

示例

下面的代码示例演示如何获取一个 Table 对象,该对象根据 LastModificationTime 收件箱中的项目。 它还演示如何自定义列在 表 中,以及如何枚举和打印这些项目对应属性的值。

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

方法

名称
BinaryToString
GetValues
项
LocalTimeToUTC
UTCToLocalTime

属性

名称
Application
类
Parent
Session

另请参阅

Outlook 对象模型引用

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。