SaveOption Property

Microsoft Outlook Visual Basic

constant that specifies the folders in which the specified view is available and the read permissions attached to the view. The SaveOption property is set when the View object is created by using the Add method. Read-only.

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 Microsoft Visual Basic/Visual Basic for Applications (VBA) example displays the names of all views that can be accessed by all users in the Notes folder.

The following example locks the user interface for all views that are available to all users. The subroutine LockView accepts the View object and a Boolean value that indicates if the View interface will be locked. In this example the procedure is always called with the Boolean value set to True.

Sub LocksPublicViews()
'Locks the interface of all views that are available to
'all users of this folder.

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

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

    For Each objView In objViews
        If objView.SaveOption = olViewSaveOptionThisFolderEveryone Then
           Call LockView(objView, True)
        End If
    Next objView

End Sub

Sub LockView(ByRef objView As View, ByVal blnAns As Boolean)
'Locks the user interface of the view.
'Accepts and returns a View object and user response.

    With objView
        If blnAns = True Then
            'if true lock UI
            .LockUserChanges = True
            .Save
        Else
            'if false don't lock UI
            .LockUserChanges = False
        End If
    End With

End Sub