Skip to content

Latest commit

 

History

History
108 lines (55 loc) · 3.1 KB

Outlook.FormDescription.PublishForm.md

File metadata and controls

108 lines (55 loc) · 3.1 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
FormDescription.PublishForm method (Outlook)
vbaol11.chm201
vbaol11.chm201
Outlook.FormDescription.PublishForm
2040736a-4be0-90c4-0dfc-20c6ee4eb305
06/08/2017
medium

FormDescription.PublishForm method (Outlook)

Saves the definition of the FormDescription object in the specified form registry (library).

Syntax

expression. PublishForm( _Registry_ , _Folder_ )

expression A variable that represents a FormDescription object.

Parameters

Name Required/Optional Data type Description
Registry Required OlFormRegistry The form class.
Folder Optional Variant Expression that returns a Folder object. Used only with Folder form registry. The folder object from which the forms must be accessed.

Remarks

Note

The Name property must be set before you can use the PublishForm method.

Forms are registered as one of three classes: Folder, Organization, or Personal. The Folder form registry holds a set of forms that are only accessible from that specific folder, whether public or private. The Organization form registry holds forms that are shared across an entire enterprise and are accessible to everyone. The Personal form registry holds forms that are accessible only to the current store user.

Example

This Visual Basic for Applications (VBA) example creates a contact, obtains its FormDescription object, and saves it in the Folder form registry of the default Contacts folder.

Note

The PublishForm method will return an error if the caption (Name) for the form is not set first.

Sub PublishToFolder() 
 
 Dim myNamespace As Outlook.NameSpace 
 
 Dim myFolder As Outlook.Folder 
 
 Dim myItem As Outlook.ContactItem 
 
 Dim myForm As Outlook.FormDescription 
 
 
 
 Set myNamespace = Application.GetNamespace("MAPI") 
 
 Set myFolder = _ 
 
 myNamespace.GetDefaultFolder(olFolderContacts) 
 
 Set myItem = Application.CreateItem(olContactItem) 
 
 Set myForm = myItem.FormDescription 
 
 myForm.Name = "My Contact" 
 
 myForm.PublishForm olFolderRegistry, myFolder 
 
End Sub

This VBA example creates an appointment, obtains its FormDescription object, and saves it in the user's Personal form registry.

To view the form after you have published it, on the File menu, point to New, and click Choose Form. In the Look in box, click Personal Forms Library. To open your new form, double-click Interview Scheduler.

Set myItem = Application.CreateItem(olAppointmentItem) 
 
Set myForm = myItem.FormDescription 
 
myForm.Name = "Interview Scheduler" 
 
myForm.PublishForm olPersonalRegistry

See also

FormDescription Object

[!includeSupport and feedback]