Outlook) (Row 物件

代表 Table 物件中的資料列。

註解

Table 是由列及欄組成的。 它代表 FolderSearch 物件中資料的唯讀動態資料列集。 您可以將 Table 的每列視為資料夾中的項目,而將每欄視為項目的屬性。 根據預設,Table 只含有資料夾中的項目屬性子集。 這使得 Table 成為支援資料夾項目快速列舉和篩選的記憶體內部輕量資料列集。

如果 Table 物件取自 Folder.GetTable,您可以進一步指定篩選 (在 Table.Restrict 中) 取得 Table 中的有限列集。

使用 Table 方法: FindRowFindNextRowGetNextRowMoveToStart 來取得 Table 中的特定資料

使用 Row.GetValues 取得對應至 Table 中該資料列之資料行值的值數

使用協助程式函式 Row.BinaryToStringRow.LocalTimeToUTCRow.UTCToLocalTime 來加速特定資料列的資料行數值型別轉換。 如需 Table 中屬性值形式的詳細資訊,請參閱影響 Table 及 View 類別之屬性值表示的因素

雖然 Table 中的列會反映基礎資料夾的新增及刪除,但是 Table 並不支援新增、變更及移除列的任何事件。 如果您需要 Table 列中的可寫入物件,請從 Table 的預設 EntryID 欄取得該列的項目 ID,然後使用 NameSpace 物件的 GetItemFromID 方法來取得完整項目,例如支援讀寫作業的 MailItemContactItem 。 如需 Table 的預設欄的詳細資訊,請參閱 Table 物件中顯示的預設屬性

範例

在下列程式碼範例中,會說明如何根據 [收件匣] 中項目的 LastModificationTime,取得 Table 物件。 它也會示範如何自訂 Table中的資料行,以及如何列舉和列印這些專案的對應屬性值。

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
Item
LocalTimeToUTC
UTCToLocalTime

屬性

名稱
Application
Class
Parent
Session

另請參閱

Outlook 物件模型參考

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應