Folder.Views Property

Outlook Developer Reference

Returns the Views collection object of the Folder object. Read-only.

Version Information
 Version Added:  Outlook 2007

Syntax

expression.Views

expression   A variable that represents a Folder object.

Example

The following Microsoft Visual Basic/Visual Basic for Applications (VBA) example creates an instance of the Views collection and displays the XML definition of a view called "Table View". If the view does not exist, it creates one.

Visual Basic for Applications
  Sub DisplayViewDef()
    'Displays the XML definition of a View object
    Dim objName As Outlook.NameSpace
    Dim objViews As Outlook.Views
    Dim objView As Outlook.View
Set objName = Application.GetNamespace("MAPI")
Set objViews = objName.GetDefaultFolder(olFolderInbox).<strong>Views</strong>
'Return a view called Table View if it already exists, else create one
Set objView = objViews.Item("Table View")
If objView Is Nothing Then
    Set objView = objViews.Add("Table View", olTableView, _
        olViewSaveOptionAllFoldersOfType)
End If
MsgBox objView.XML

End Sub

See Also