AddToPFFavorites Method

Microsoft Outlook Visual Basic

AddToPFFavorites Method

       

Adds the current folder to the Public Folder's Favorites Folder.

expression.AddToPFFavorites

expression   Required. An expression that returns a MAPIFolder object.

Remarks

Only Public Folders can be added to the Favorites Folder.

Example

The following example adds the public folder Internet Newsgroups to the user's Favorites Folder by using the AddToPFFavorites method.

Sub AddToFavorites()
'Adds a Public Folder to the List of favorites

    Dim olapp As Outlook.Application
    Dim objFolder As MAPIFolder

    Set olapp = Outlook.Application
    Set objFolder = _
        olapp.GetNamespace("mapi").Folders.Item(1).Folders(2). _
        Folders("Internet Newsgroups")
    objFolder.AddToPFFavorites

End Sub