Microsoft KB Archive/239005

From BetaArchive Wiki

Article ID: 239005

Article Last Modified on 11/23/2006



APPLIES TO

  • Microsoft Outlook 2000 Standard Edition



This article was previously published under Q239005

SUMMARY

Although the AddToPFFavorites method is not documented in the Microsoft Outlook Visual Basic Reference (Vbaoutl9.chm), it does exist in the Outlook object model and can be used to add a public folder into the Favorites folder.

MORE INFORMATION

The Favorites folder is located in the public folder list at the same level as the All Public Folders folder. In the Outlook user interface, when you drag a public folder into the Favorites folder, the folder is then synchronized if you use Outlook offline (with an .ost file).

The AddToPFFavorites method provides the same functionality in the Outlook object model and therefore allows you to programmatically specify that a public folder should be available while a user is offline. When using the AddToPFFavorites method, the folder is placed at the top level in the Favorites folder, and any subfolders are automatically included and therefore also synchronized.

The AddToPFFavorites method was added late in the development process, after the object model documentation was complete. However, it is mentioned on the CD-ROM that accompanies Building Applications with Microsoft Outlook 2000, by Microsoft Press.

The AddToPFFavorites method is available from a MAPIFolder object and takes no arguments.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

AddToPFFavorites Method

Syntax

object.AddToPFFavorites

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

AddToPFFavorites Method Example

This Microsoft Visual Basic/Visual Basic for Applications example adds a folder called Shared Contacts to the Favorites folder. In this example, the Shared Contacts folder is assumed to be located in the All Public Folders folder.

Dim myOlApp As New Outlook.Application
Dim myNS As Outlook.NameSpace
Set myNS = myOlApp.GetNamespace("MAPI")
Set myAPF = myNS.Folders("Public Folders").Folders("All Public Folders")
myAPF.Folders("Shared Contacts").AddToPFFavorites
                    

If you use VBScript, you do not create the Application object. This example shows how to perform the same task using VBScript.

Set myNS = Application.GetNamespace("MAPI")
Set myAPF = myNS.Folders("Public Folders").Folders("All Public Folders")
myAPF.Folders("Shared Contacts").AddToPFFavorites
                    

REFERENCES

For additional information about available resources and answers to commonly asked questions about Microsoft Outlook 2000 solutions, please see the following article in the Microsoft Knowledge Base:

146636 OL2000: Questions About Custom Forms and Outlook Solutions



Additional query words: OutSol OutSol2000 vbscript

Keywords: kbhowto kbprogramming KB239005