FolderPath Property

Microsoft Outlook Visual Basic

expression.FolderPath

expression    Required. An expression that returns a MAPIFolder object.

Example

The following example displays information about the default Contacts folder. The subroutine accepts a MAPIFolder object and displays the folder's name, path, and address book information.

Sub Folderpaths()

    Dim olApp As Outlook.Application
    Dim nmsName As NameSpace
    Dim fldFolder As MAPIFolder

    Set olApp = Outlook.Application
    'Create namespace reference
    Set nmsName = olApp.GetNamespace("MAPI")
    'create folder instance
    Set fldFolder = nmsName.GetDefaultFolder(olFolderContacts)
    'call sub program
    Call FolderInfo(fldFolder)

End Sub

Sub FolderInfo(ByVal fldFolder As MAPIFolder)
'Displays information about a given folder

    MsgBox fldFolder.Name & "'s current path is " & fldFolder.FolderPath & _
             ". The current address book name is " & fldFolder.AddressBookName & "."

End Sub