Criar uma região de formulário

This topic lists the considerations and steps for creating a form region.

There are different types of form regions, depending on how you want to customize the form and where you place the form region in the form. A form region can add extra user interface to the default page or add an extra page to a standard form. Or, it can replace the default page of a standard form, or replace the entire standard form, resulting in a new form for a derived message class. Especifique o tipo da região do formulário em um arquivo XML de manifesto da região do formulário, usando a <formRegionType> marca conforme descrito na etapa 7. Aside from this, the means to create and design these various types of form regions is identical:

  1. Use the Forms Designer to create and design the layout (steps 1 through 5)

  2. Save the form region to an Outlook Form Storage (.OFS) file (step 6)

  3. Create a form region manifest XML file to specify other details about the form region to Microsoft Outlook (step 7)

  4. Register the form region for a message class (step 9)

When you restart Outlook, the form region will be available for use. Alternatively, you can create the form region and the form region manifest XML file, use an add-in to extend the form region and register the form region programmatically. When you install the add-in, the add-in will also install the form that contains the form region.

Para obter mais informações, consulte Estendendo uma região do formulário com um suplemento.

O procedimento a seguir detalha as etapas para a criação de uma região do formulário, utilizando o Designer de Formulários sem um suplemento.

  1. On the Developer tab, in the Custom Forms group, click Design a Form.

  2. Select one of the nine standard Outlook forms that is best suited for your purpose: Appointment, Contact, Journal Entry, Meeting Request, Message, Post, RSS Article, Task, and Task Request.

    When you customize a form, you always start with a standard form as a template. When you choose the standard form, you should consider the following:

    • As ações associadas ao formulário, por exemplo, se você enviará o formulário para outras pessoas, nesse caso, você deve escolher o formulário Mensagem.

    • Os tipos de campos que você precisará no formulário, por exemplo, se eles são principalmente campos específicos para contato.

  3. Plan the scope of your customization. Will it suffice if you add extra controls to the bottom of the default page of the standard form? Will you need an extra custom page? Or, will you want to modify the user interface so substantially that it would be easier to create a new form? Note that you can replace pages on a form only if you specify that form for a derived message class.

  4. In the Forms Designer, on the Developer tab, in the Design group, click New Form Region.

    Note that any type of form region opens as a separate page in the Forms Designer. At runtime, the form region will be displayed the way you have specified in the form region manifest XML file, as described in step 7.

  5. Design the layout of the form region by dragging and dropping controls from the Toolbox to the form region, and binding them to fields where appropriate.

    Similar to customizing a form page, customizing a form region involves defining custom fields, inserting controls using the Toolbox, and binding the controls with fields using the Field Chooser. Para obter mais informações, consulte Controles em um formulário personalizado e a seção Projetar a região do formulário em Acompanhamento: Adicionar uma região do formulário a uma página existente em um formulário. Optionally, you can use an add-in to program events of the controls.

  6. Save the layout of the form region by clicking Save Region, and then Save Form Region in the Design group. The form region layout file will be saved with a .OFS extension.

  7. Use um editor XML, como o Bloco de Notas, para criar um arquivo XML de manifesto da região do formulário.

    Você deve especificar XML para cada região de formulário para informar ao Outlook como exibi-lo e as ações que ele dá suporte. The XML must validate against the form region manifest schema (for more information about the schema, see the Microsoft Outlook 2010 XML Schema Reference in the MSDN Library). The schema supports many elements, such as the more commonly used ones enumerated below:

    • The <addin> tag specifies the ProgID of the add-in that manages the form region and provides storage for it. You should only specify this tag if you use an add-in to create and manage the form region.

    • The <customActions> tag that specifies the actions supported by the form region, for example, reply and forward.

    • The <displayAfter> tag specifies the form region that precedes the current form region in the same form. This information defines the initial order of multiple adjoining form regions or multiple separate form regions in the same form.

    • The <formRegionType> tag specifies whether the form region is an additive form region (adjoining or separate form region), or is a replacement or replace-all form region (replacing the default page or the entire standard form and resulting as a new form for a derived message class).

    • The <layoutFile> tag specifies the location of the .OFS file, if one exists. Note that any file paths in the .OFS file, including this file path, can be specified as a relative path to the location of the form region manifest XML file specified in the registry. However, also note that UNC paths are not supported. If you use an add-in to create and manage the form region, you must specify the <addin> tag but not this tag.

    • The <name> tag specifies the name for the form region used only in code.

    • A <marca de título> especifica o nome de exibição de uma região de formulário separada no menu Ações e na caixa de diálogo Escolher Formulário .

    • The <icons> tag specifies the location of icon files.

    Observação

    [!OBSERVAçãO] By default, the icon file is in the same folder as, or in a path relative to, the form region manifest XML file. You can also specify a full path for the icon file, for example: <icons><default>c:\myicon.ico</default></icons>or a full path for a resource file, for example: <icons><unread>c:\myresource.dll,101</unread> </icons>which loads the icon resource 101 in the resource file c:\myresource.dll. No entanto, não use a convenção implícita que especifica ícones inseridos no arquivo de assembly de suplemento. Por exemplo: <icons><read>,102</read></icons>não haverá suporte e não carregará o recurso de ícone 102 na dll de suplemento.

  8. Close Outlook.

  9. Registre a região do formulário no registro do Windows, especificando a classe de mensagem para a qual essa região de formulário é destinada e o caminho de arquivo completo para o arquivo XML de manifesto da região do formulário.

    Registre regiões de formulário no HKEY_CURRENT_USER ou no hive HKEY_LOCAL_MACHINE no registro do Windows. For example, additive form regions for the IPM.Contact message class for the current user should be registered under the same key, HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\FormRegions\IPM.Contact. Note that the form region will be displayed for the current user in all forms applied to IPM.Contact and any message class derived from IPM.Contact. Se você quiser que uma região de formulário seja usada apenas para IPM. Entre em contato e não deseje classes de mensagens derivadas para usar essa região de formulário, você pode especificar isso usando a <marca exactMessageClass> no arquivo XML do manifesto da região do formulário.

  10. Inicie o Outlook. Ao abrir um item da classe de mensagem especificada para a região do formulário na etapa 9, você verá a região do formulário no inspetor.

Suporte e comentários

Tem dúvidas ou quer enviar comentários sobre o VBA para Office ou sobre esta documentação? Confira Suporte e comentários sobre o VBA para Office a fim de obter orientação sobre as maneiras pelas quais você pode receber suporte e fornecer comentários.