Public Sub PlayWithTable()
Dim myTable As Outlook.Table
Dim colColumns As Outlook.Columns
Dim oColumn As Outlook.Column
Dim oFolder As Outlook.Folder
Dim myMailItem As Outlook.MailItem
Dim oRow As Outlook.Row
Dim oProp As Outlook.UserProperty
Dim aryValues() As Variant
Dim strEntryID As String
Set oFolder = Application.Session.GetDefaultFolder(olFolderSentMail)
Set myTable = oFolder.GetTable 'returns all items in folder
Set colColumns = myTable.Columns
colColumns.RemoveAll
Set oColumn = colColumns.Add("EntryID")
Set oColumn = colColumns.Add("Importance")
Do While myTable.EndOfTable = False
Set oRow = myTable.GetNextRow
aryValues = oRow.GetValues
If aryValues(1) = OlImportance.olImportanceHigh Then
strEntryID = aryValues(0)
Set myMailItem = Application.Session.GetItemFromID(strEntryID)
Set oProp = myMailItem.UserProperties.Add("VeryImportant", olYesNo)
oProp.Value = True
myMailItem.Save
End If
Loop
End Sub
|