expression.SetColumns(Columns)
expression Required. An expression that returns one of the objects in the Applies To list.
Columns Required. A String containing the names of the properties to be cached, separated by commas.
Remarks
For the Items object, SetColumns cannot be used, and will cause an error, with any property that returns an object, and it cannot be used with the following properties:
Body
Categories Children Class Companies Contacts DLName EntryID HTMLBody ReceivedOnBehalfOfEntryID ReceivedByEntryID DownloadState MeetingWorkspaceURL |
MemberCount RecurrenceState ReplyRecipients ResponseState Saved Sent Submitted VotingOptions BodyFormat IsConflict InternetCodePage AutoResolvedWinner |
Note The ConversationIndex property cannot be cached using the SetColumns method in Office Outlook 2003. However, this property will not result in an error like the other properties listed above.
Example
The following Visual Basic for Applications (VBA) example uses the Items collection to get the items in default Tasks folder, caches the Subject and DueDate properties and then displays the subject and due dates each in turn.
Sub SortByDueDate()
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim myItem As Object
Dim myItems As Outlook.Items
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderTasks)
Set myItems = myFolder.Items
myItems.SetColumns ("Subject, DueDate")
For Each myItem In myItems
MsgBox myItem.Subject & " " & myItem.DueDate
Next myItem
End Sub