Partager via


AddToPFFavorites Method

Adds a Microsoft Exchange public folder to the public folder's Favorites folder.

expression.AddToPFFavorites

*expression   * Required. An expression that returns a **MAPIFolder**object.

Example

The following Visual Basic for Applications (VBA) example adds the public folder GroupDiscussion to the user's Favorites folder by using the AddToPFFavorites method. To run this example, you need to replace 'GroupDiscussion' with a valid public folder name.

Sub AddToFavorites()
    'Adds a Public Folder to the list of favorites
    Dim olapp As Outlook.Application
    Dim objFolder As Outlook.MAPIFolder
    Set olapp = New Outlook.Application
    Set objFolder = olapp.Session.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("GroupDiscussion")
    objFolder.AddToPFFavorites
End Sub

Applies to | MAPIFolder Object

See Also | AddToFavorites Method