Share via


SaveOption Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.  

OlViewSaveOption

OlViewSaveOption can be one of these OlViewSaveOption constants.
olViewSaveOptionAllFoldersOfType All folders of this type can use the view.
olViewSaveOptionThisFolderEveryone All users who can access the current folder can use the view. The view is only associated with this folder.
olViewSaveOptionThisFolderOnlyMe The view is only associated with the current folder and only the user can access the view.

expression.SaveOption

expression   Required. An expression that returns a View object.

Example

The following example displays the names of all views that can be accessed by all users in the Notes folder.

  Sub DisplayPublicViews()
'Displays the names of all views that are available to
'all users of this folder

    Dim olApp As Outlook.Application
    Dim objName As NameSpace
    Dim objViews As Views
    Dim objView As View
    Dim strSaveOption As String

    Set olApp = Outlook.Application
    Set objName = olApp.GetNamespace("MAPI")
    Set objViews = objName.GetDefaultFolder(olFolderNotes).Views

    For Each objView In objViews
        If objView.SaveOption = olViewSaveOptionThisFolderEveryone Then
            'if list is empty, start list
            If strSaveOption = "" Then
                strSaveOption = "The following views are available" & _
                                " to all users:" & vbCr & vbCr & objView.Name & vbCr
            Else
            'If not empty, add names to list
                strSaveOption = strSaveOption & _
                                objView.Name & vbCr
            End If
        End If
    Next objView
    'If views exist display names
    If strSaveOption <> "" Then
        MsgBox strSaveOption
    End If

End Sub