Escolher uma API ou tecnologia para desenvolver soluções para o Outlook

Este artigo descreve as APIs e tecnologias que você pode usar para estender o Outlook 2013 e o Outlook 2016 e ajuda você a se decidir pela API ou a tecnologia apropriada para seu cenário.

A Microsoft oferece suporte a várias APIs e tecnologias que estendem o Outlook:

  • Starting in Office 2013, the apps for Office platform opens up opportunities to extend Outlook functionality across Outlook clients on the desktop, tablet and smart phone. The platform includes a JavaScript API for Office and a schema for app manifests.

  • O modelo de objeto, o Microsoft Outlook Primary Interop Assembly (PIA), e o MAPI (Messaging API) têm sido as APIs mais comumente usadas nas soluções do Outlook.

  • As APIs auxiliares complementam o MAPI em alguns cenários.

  • Outlook Social Connector (OSC) provider extensibility and the Weather Bar extensibility serve specific scenarios of their niche markets.

This article explains the selection criteria for the Suplementos do Office platform, the object model, PIA, and MAPI. Note that Suplementos do Office use the JavaScript API for Office and do not call into the object model, and vice versa. Solutions that use the other APIs can use one or more APIs. For example, a COM add-in written in C++ can use the object model, MAPI, and auxiliary APIs in the same solution.

To get the most benefit from this article, you should be familiar with Outlook at the user level and have general software development knowledge. However, you do not need to have a comprehensive understanding of the features that these APIs or technologies support. The article helps answer the following questions:

  • Se você tem apenas uma ideia sobre os objetivos de sua solução, o mercado-alvo e os recursos disponíveis, que outros critérios você deve considerar para selecionar uma API?

  • Por que você deve considerar os suplementos do Office e quando optar por criar aplicativos em vez de suplementos?

  • Se a solução tiver que ser executada nas versões anteriores do Outlook, incluindo o Outlook 2003, como isso afeta a sua escolha da API?

  • Se a solução tiver que se iterar nas pastas do Outlook que contenham milhares de itens e você precisar modificar esses itens, qual API seria melhor?

  • Se sua solução depende muito da lógica comercial do Outlook e interage com outros aplicativos do Office, o modelo de objeto do Outlook é a melhor opção?

  • O que o modelo de objeto e o MAPI permitem estender no Outlook?

  • Se for possível usar o modelo de objeto ou o MAPI para realizar sua tarefa, como você deverá decidir qual API usar?

Critérios de avaliação objetiva

This section describes criteria that you can use to compare the Suplementos do Office platform, object model, PIA, and MAPI to determine which better meets your needs. Different criteria can be more or less important, depending on your projects and available resources.

The tables in this section define evaluation criteria in the following categories:

  • Critérios funcionais: descreve o que você pode e não pode fazer com a tecnologia.

  • Critérios de desenvolvimento: descreve as ferramentas de desenvolvimento ou informações que você precisa para usar a tecnologia

  • Critérios de segurança: descreve os problemas de segurança e permissões relacionados à tecnologia.

  • Deployment criteriaDescribes the recommended deployment and distribution methods for the technology.

Objective evaluation criteria for the apps for Office platform

Starting in Office 2013, developers can use the Suplementos do Office platform to extend web services and content into the context of Office rich and web clients. An Suplemento do Office is a web page that is developed using common web technologies, hosted inside an Office client application (such as Outlook), and can run on-premises or in the cloud. Of the few types of Suplementos do Office, the type that Outlook supports is called mail apps. While the object model, PIA, and MAPI are often used to automate Outlook at an application level, you can use the JavaScript API for Office to interact at an item level with the content and properties of an email message, meeting request, or appointment. You can publish mail apps to the Office Store or an internal Exchange catalog.

End users and administrators can install mail apps on an Exchange mailbox, and use mail apps in the Outlook rich client as well as Outlook Web App. As a developer, you can choose to make your mail app available on only the desktop, or also on the tablet or smart phone. Figure 1 shows an example of a YouTube mail app, which is described in detail in Exemplo: Criar um aplicativo de email para exibir vídeos do YouTube no Outlook. The YouTube mail app allows end users select a URL for a YouTube video and watch the video within Outlook or Outlook Web App, on the desktop or tablet.

Figura 1. O aplicativo de email do YouTube está ativo para a mensagem selecionada, que contém uma URL para um vídeo no YouTube.com

Aplicativo de email do YouTube no Outlook

After a user installs a mail app, the app is available for use in the app bar when the current context matches the activation conditions that the app specifies. A mail apps allows you to specify rules about the currently selected item that activate a mail app only if certain conditions are met. For example, the YouTube mail app that lets you play a YouTube video within Outlook is relevant only when the selected Outlook item contains a URL to a video on YouTube.com. In this case, you would specify that the app should be active only when the selected message contains such a URL.

The following tables show the evaluation criteria for the Suplementos do Office platform.

Critérios funcionais

Criteria Suporte a aplicativos de email em aplicativos para a plataforma do Office
Application domain The scope of activity of a mail app is virtually any supported message or appointment item in the user's Exchange mailbox that the user has selected and that satisfies the activation conditions. The permissions of a mail app determine its access to the properties and specific entities (such as an email address or telephone number) that exist for that item. For example, a mail app requesting the read/write mailbox permission can read and write all the properties of any item in the user's mailbox; create, read, and write to any folder or item; and send an item from that mailbox.
Major objects The JavaScript API for Office provides a few objects at the top level that are shared by all the types of Suplementos do Office: Office, Context, and AysncResult. The next level in the API that is applicable and specific to mail apps includes the Mailbox, Item, and UserProfile objects, which support accessing information about the user and the item currently selected in the user's mailbox. At the data level, the CustomProperties and RoamingSettings objects support persisting properties set up by the mail app for the selected item and for the user's mailbox, respectively. Item-level objects include the Appointment and Message objects that inherit from Item, and the MeetingRequest object that inherits from Message. These represent the types of Outlook items that support mail apps: calendar items of appointments and meetings, and message items such as email messages, meeting requests, responses, and cancellations. Beyond this level in the API are item-level properties (such as Appointment.subject) as well as objects and properties that support certain known Entities objects (for example Contact, MeetingSuggestion, PhoneNumber, and TaskSuggestion). See Visão geral dos recursos e a arquitetura de suplementos do Outlook for a summary of the features supported for mail apps.
Modelo de acesso a dados A API do JavaScript para Office representa os recursos a seguir como um conjunto hierárquico de objetos: ambiente de tempo de execução do aplicativo, caixa de correio do usuário e o perfil, além de dados sobre um item.
Modelos de Threading Cada aplicativo de email é executado em seu próprio processo separado do processo do Outlook.
Arquiteturas de aplicativos No Outlook, um aplicativo de email é um conjunto de páginas da Web HTML e JavaScript hospedadas como um processo separado dentro de um controle de navegador da web que, por sua vez, é hospedado dentro de um processo de tempo de execução do aplicativo que fornece isolamento de segurança e desempenho.
Remote usage Mail apps use the JavaScript API for Office to access data about the current user, mailbox, and selected item stored on the corresponding Exchange Server. Provided that they have the appropriate permissions and use the appropriate technique for cross-domain access, mail apps can also call Exchange Web Services and other third-party web services to extend their functionality.
Transactions A API JavaScript para Office não oferece suporte a transações.
Disponibilidade A API JavaScript para Office está disponível para caixas de correio no Exchange Server 2013, começando no Outlook 2013.

Critérios de desenvolvimento

Criteria Suporte a aplicativos de email em aplicativos para a plataforma do Office
Languages and tools You can implement mail apps using any common web technology, including HTML5, JavaScript, CSS3, XML, and REST APIs. You can use your preferred web development tool. Alternatively, using Napa, Visual Studio 2012, or a later version of these tools provides conveniences that save you time in development.
Managed implementation Quando for apropriado em seu cenário, você poderá usar páginas Managed.aspx para implementar o código do lado do servidor para seus aplicativos de email.
Programável A API avaScript para Office é usada diretamente em scripts.
Test and debug tools You can use any web development tools you prefer. Napa and Visual Studio provide an integrated development environment that facilitates app testing and debugging. Solucionar problemas de ativação do suplemento do Outlook and Exemplo: Depurar propriedades de itens do Outlook provide further help in troubleshooting and debugging mail apps.
Expert availability Programmers who have the required level of web development expertise for Suplementos do Office are relatively easy to find. The platform is intended for both professional and non-professional developers.
Available information Information about developing and posting Suplementos do Office is available at Build apps for Office and SharePoint. Specific documentation for mail apps is available at Suplementos do Outlook.
Developer and deployment licensing Consulte Licenciar seus suplementos do Office e do SharePoint para obter informações sobre a estrutura de licença do aplicativo para suplementos do Office.

Critérios de segurança

Criteria Suporte a aplicativos de email em aplicativos para a plataforma do Office
Permissões de tempo de design Nenhuma permissão especial é necessária para o desenvolvimento de aplicativos de email.
Configuração de permissões Por padrão, os usuários finais e os administradores podem instalar aplicativos de email de baixa confiança que exigem permissão restrita ou de leitura de item, e os administradores podem instalar aplicativos de email de alta confiança que exijam permissão de leitura/gravação de caixa de correio.
Permissões de tempo de execução Aplicativos de email solicitam um determinado nível de permissão que se baseia em um modelo de permissões de três camadas: restrita, leitura de item e leitura/gravação de caixa de correio.
Recursos internos de segurança O runtime de Suplementos do Office fornece os seguintes benefícios para evitar que um aplicativo prejudique o ambiente do usuário final: Isola o processo em que o aplicativo é executado. Não envolve substituição de .dll ou .exe ou componentes ActiveX. Facilita a instalação ou a desinstalação de aplicativos do usuário final. O administrador e os usuários finais têm controle sobre os aplicativos de email disponibilizados e se devem conceder a permissão solicitada antes de instalar um aplicativo de email. No caso de clientes avançados, controla o uso de memória e CPU para impedir ataques maliciosos de negação de serviço.
Recursos de monitoramento de segurança Para aplicativos de email, os seguintes recursos são monitorados: uso do núcleo da CPU. Uso de memória. Número de falhas. Intervalo de tempo para bloquear um aplicativo. Tempo de resposta de expressão regular. Número de vezes que você reavalia as expressões regulares. Os administradores podem substituir as configurações padrão que governam o uso do recurso.

Critérios de implantação

Criteria Suporte a aplicativos de email em aplicativos para a plataforma do Office
Requisitos da plataforma do servidor A caixa de correio do usuário na qual um aplicativo de email está instalado deve estar no Exchange Server 2013 ou em uma versão posterior.
Requisitos da plataforma do cliente Para que um aplicativo de email seja executado no cliente avançado do Outlook, no Outlook 2013, no Internet Explorer 9, ou em uma versão posterior desses aplicativos, eles devem estar instalados no computador local.
Deployment methods You can publish mail apps to the Office Store or to an Exchange catalog that makes the app available to users on that Exchange Server. Administrators or users can then choose to install a mail app from the Office Store or Exchange catalog, by using either the Exchange Admin Center (EAC) or by running remote Windows PowerShell cmdlets. You can access the EAC from the Outlook Backstage view or Outlook Web App, or by directly signing into the EAC for your mailbox. Para obter mais informações, consulte Implantar e instalar suplementos do Outlook para teste.
Notas de implantação Once you install a mail app on Outlook or Outlook Web App, the mail app is available for that mailbox on both Outlook clients.

Objective evaluation criteria for the object model and PIA

Solutions that run on the client computer can use the Outlook object model or PIA to programmatically access Outlook items, such as contacts, messages, calendar items, meeting requests, and tasks. Unlike MAPI, the Outlook object model and PIA can provide event notifications for Outlook user-interface changes, such as changing the current folder or displaying an Outlook inspector.

Observação

Para obter uma solução para acessar os dados armazenados em uma caixa de correio do Microsoft Exchange ou em um arquivo de pastas particulares (.pst), o Outlook deve ser instalado e configurado no computador cliente em que o aplicativo está sendo executado. > O modelo de objeto do Outlook e a PIA dão suporte à mesma funcionalidade para estender o Outlook. O PIA define interfaces gerenciadas que são mapeadas para o modelo de objeto baseado em COM e com as quais uma solução gerenciada pode interagir. Nas discussões restantes nesta seção, a maioria dos critérios funcionais, de segurança e de implantação se aplicam ao modelo de objeto e ao PIA da mesma maneira. Para obter mais informações sobre como o PIA facilita a interoperabilidade entre o COM e o .NET Framework, confira Introdução à interoperabilidade entre COM e .NET e Arquitetura do PIA do Outlook.

As tabelas a seguir mostram os critérios de avaliação para o modelo de objeto do Outlook e o PIA.

Critérios funcionais

Criteria PIA ou modelo de objeto do Outlook
Application domain Add-ins or standalone applications that use the Outlook object model or PIA typically handle user-specific messages, customize the Outlook user interface, or create custom item types for specialized solutions such as customer relationship management (CRM) solutions that integrate with Outlook. The Outlook object model or PIA is sometimes used for message processing in an informal workflow process, especially where application development on the Microsoft Exchange Server is not permitted. Unlike browser-based clients, cached-mode operation allows Outlook solutions to work when the user is offline or disconnected from the corporate network.
Major objects The top-level object in the Outlook object model and PIA is the Outlook Application object. Explorers, Conversation, Inspectors, Views, NavigationPane, SolutionsModule, FormRegion, and related objects represent elements of the Outlook user interface. The NameSpace, Stores, Folders, Accounts, AccountSelector, AddressEntries, ExchangeUser, and related objects support extending Outlook sessions, profiles, user accounts, message stores, and folders. At the data level, a number of item-level objects, such as MailItem, AppointmentItem, ContactItem, and TaskItem, represent the built-in Outlook item types. The PropertyAccessor, Table, Search, ItemProperties, UserDefinedProperties, Attachments, Categories, Recipients, RecurrencePattern, Reminders, Rules, and related objects support customizing and manipulating item-level objects.
Data-access model O modelo de objeto do Outlook e PIA representam todos os dados como um conjunto hierárquico de objetos e coleções.
Threading models All calls to the Outlook object model and PIA execute on Outlook's main foreground thread. The only threading model that the Outlook object model supports is single-threaded apartment (STA). Calling the Outlook object model or PIA from a background thread is not supported and can lead to errors and unexpected results in your solution.
Application architectures Typically, COM add-ins and other Office applications use the Outlook object model to extend Outlook. Managed solutions can use the Outlook PIA and the COM interoperability layer of Visual Studio and the .NET Framework to access the Outlook object model. Visual Studio provides templates and additional class libraries and manifests to facilitate Office document and application customizations. For more information about using Visual Studio to develop managed add-ins for Outlook, see Architecture of Application-Level Add-Ins and Outlook Solutions. The Outlook object model also supports Visual Basic for Applications (VBA) macros and Windows Scripting Host (WSH), but does not support Windows Service applications.
Remote usage The Outlook object model and PIA can be used only on a computer on which Outlook is installed. The Outlook object model can be used to access information stored in Exchange that is available in the Outlook application.
Transactions O modelo de objeto do Outlook e PIA não dão suporte a transações.
Availability The Outlook object model is currently available in all versions of Outlook. The PIA is available in versions of Outlook since Outlook 2003. There have been extensions and improvements with each new version of Outlook.

Development criteria

Criteria PIA ou modelo de objeto do Outlook
Languages and tools You can implement Outlook object model applications by using any COM or automation-compatible language, such as Visual Basic or C#, as well as non-COM languages, such as native C or C++. Microsoft Office development tools in Microsoft Visual Studio 2010 are the preferred tools for development of managed add-ins for Outlook 2010 and Outlook 2007. Microsoft Visual Studio 2005 Tools for the Microsoft Office System are the preferred tools for Outlook 2003. You can also use Office development tools in Visual Studio 2010 to create solutions for 32-bit and 64-bit versions of Outlook. When you build a solution in Office development tools in Visual Studio 2010 or Microsoft Visual Studio Tools for the Microsoft Office System, specifying the Any CPU option for the target platform results in managed solutions that work for both 32-bit and 64-bit versions of Outlook 2010.
Managed implementation O Outlook PIA permite que o modelo de objeto do Outlook seja usado em um ambiente de código gerenciado, que é suportado por um conjunto avançado de bibliotecas de classes e tecnologias de suporte que abordam muitas limitações de suplementos VBA e COM. O PIA é um wrapper COM que atua como uma ponte entre os ambientes gerenciado e COM. Para obter mais informações, consulte Por que usar o Outlook PIA.
Scriptable O modelo de objeto do Outlook pode ser usado em scripts.
Test and debug tools No special debugging tools are needed to use the Outlook object model or PIA. On the other hand, you can use Visual Studio to provide an integrated development environment that facilitates application testing and debugging.
Expert availability Developers who can successfully develop applications by using the Outlook object model or PIA are relatively easy to find. The Outlook object model and PIA are intended for add-ins created by using widely available development tools, such as Visual Studio. These tools provide design-time environments that simplify the development process.
Available information Information about programming by using the Outlook object model is available in both Microsoft and third-party resources. For more information about the Outlook object model, see the Outlook 2010 Developer Reference. For more information about the Outlook PIA, see the Outlook 2010 Primary Interop Assembly Reference. For examples of managed Outlook solutions developed by using Office development tools in Visual Studio, see Outlook Solutions with Visual Studio.
Developer and deployment licensing Confira o seu contrato de licença de assinatura do MSDN (Microsoft Developer Network) para determinar se serão necessárias licenças adicionais para o Outlook e o modelo de objeto do Outlook usando os aplicativos.

Critérios de segurança

Criteria PIA ou modelo de objeto do Outlook
Permissões de tempo de design Nenhuma permissão especial é necessária para o desenvolvimento de aplicativos usando o modelo de objeto do Outlook ou PIA.
Setup permissions No special permissions are required to install applications that use the Outlook object model or PIA. However, local administrator rights are required to install Office and Outlook.
Run-time permissions Nenhuma permissão especial é necessária para executar aplicativos que usam o modelo de objeto do Outlook ou PIA.
Built-in security features The Outlook object model and PIA communicate with Exchange by using MAPI and with Active Directory by using Active Directory Service Interfaces (ADSI). The current security context of the user who is running the application is used to determine what resources that code can access. By default, add-ins are trusted for full access to all objects, properties, and methods in the Outlook object model or PIA. IT administrators can exercise control over which add-ins and objects can access the Outlook object model or PIA. The Outlook object model and PIA prevent code that is run outside the Outlook process from accessing secure objects and methods.
Recursos de monitoramento de segurança O Outlook monitora as seguintes métricas de um suplemento para determinar se ele deve desabilitar o suplemento: o comutador de pasta de desligamento de inicialização Item aberto Os administradores de frequência de invocação podem usar a política de grupo para substituir as configurações do usuário e controlar os suplementos executados nos computadores do usuário. Para saber mais, confira Critérios de desempenho para manter os suplementos habilitados.

Critérios de implantação

Criteria PIA ou modelo de objeto do Outlook
Requisitos da plataforma do servidor O modelo de objeto do Outlook e o PIA são tecnologias do lado do cliente.
Requisitos da plataforma do cliente Os aplicativos que usam o modelo de objeto do Outlook ou PIA para acessar os dados do Exchange exigem que o Outlook esteja instalado no computador local.
Métodos de implantação Os aplicativos que usam o modelo de objeto do Outlook ou PIA são distribuídos usando o software padrão de instalação de aplicativos.
Notas de implantação Because Outlook should not be installed on the Exchange Server, applications that use the Outlook object model or PIA cannot be run on the Exchange Server.

Objective evaluation criteria for MAPI

You can use MAPI to access items and folders in public and private stores, as well as to access the properties stored with each item. All versions of Outlook use MAPI. You can create clients that use MAPI, and can create MAPI servers and MAPI forms handlers, as well. The information in this section applies only to MAPI client applications.

Observação

[!OBSERVAçãO] MAPI is a mature mechanism used to access information in Exchange or in a personal folders (.pst) file, and MAPI provides some capabilities that are not available in any other API. However, MAPI does not work well outside an intranet, maintains an open connection for the duration of the MAPI session, and can be difficult to learn. MAPI does not enforce Outlook business logic, so you must take special care to ensure that Outlook business logic is maintained.

The following tables show evaluation criteria for MAPI.

Critérios funcionais

Criteria MAPI
Application domain Client applications that use MAPI access a user mailbox or public folder information stored in Exchange, and user directory information stored in Active Directory. Client applications that use MAPI are typically email clients, such as Outlook, and applications that require complex email processing.
Major objects MAPI objects are all obtained through the IMAPISession: IUnknown interface. The session object provides the client access to objects for working with MAPI profiles, status, message service provider administration, message store tables, and address books. The message store table contains objects for the message store, folders, messages, attachments, and recipients. The address book tables contain objects for messaging users and distribution lists.
Data-access model O MAPI representa as mensagens e os usuários como um conjunto hierárquico de objetos.
Threading models There are no specific threading prohibitions. However, applications that use free-threading should avoid sharing MAPI objects among threads due to the high costs of marshaling the object. MAPI and MAPI service providers use free-threading.
Application architectures MAPI client applications are typically Windows Forms-based client applications. However, you can use MAPI to write N-tier applications.
Remote usage MAPI uses remote procedure calls (RPCs) to communicate with the Exchange Server. Typically RPCs are intentionally blocked from passing through Internet firewalls.
Transactions O MAPI não dá suporte a transações.
Availability A MAPI stub currently ships with all versions of Windows. Office installs its own MAPI subsystem when it installs Outlook. No changes to MAPI are anticipated at this time.

Development criteria

Criteria MAPI
Languages and tools You can directly access MAPI by using C or C++. Other languages that can access the C/C++ calling convention may be able to access MAPI. The use of managed languages, such as Visual Basic or C#, is not supported. You must compile separate MAPI solutions for 32-bit and 64-bit versions of Outlook.
Managed implementation MAPI is an unmanaged component. Use of MAPI is not supported under the COM interoperability layer of Visual Studio and the .NET Framework.
Programável Os MAPI não podem ser usados diretamente em scripts.
Test and debug Tools No special debugging tools are needed to debug applications that use MAPI. On the other hand, you can use MFCMAPI. MFCMAPI uses MAPI to provide access to MAPI stores through a graphical user interface, and facilitates investigation of issues when you extend Outlook by using MAPI.
Expert availability Expert MAPI programmers can be difficult to find, and learning the technology can take a significant amount of time. In addition to the Microsoft communities, there are only a small number of high-quality third-party websites that provide helpful MAPI development information.
Available information Os livros da Microsoft e de terceiros que descrevem a programação MAPI estão disponíveis.
Licenciamento de implantação e desenvolvedor Não é necessário licenciamento especial para o desenvolvimento de aplicativos que usam MAPI.

Critérios de segurança

Criteria MAPI
Design-time permissions The developer must have permissions to access the data in the Exchange store. Exchange stores user and distribution list information in Active Directory, so developers who create MAPI client applications that access that information must have the ability to retrieve and set that information.
Setup permissions Configurar aplicativos baseados em MAPI geralmente exige que o usuário seja um administrador local ou tenha direitos para instalar o software.
Permissões de tempo de execução Executar um aplicativo baseado em MAPI geralmente exige que o usuário tenha permissões suficientes para acessar os dados em um repositório do Exchange ou em um arquivo de pastas particulares (.pst).
Recursos internos de segurança Os perfis MAPI podem ser protegidos por senha na maioria das plataformas.

Critérios de implantação

Criteria MAPI
Requisitos da plataforma do servidor O Exchange Server em que os dados do usuário são armazenados para os usuários do aplicativo cliente MAPI devem ser configurados corretamente para permitir o acesso pelos clientes MAPI.
Requisitos da plataforma do cliente O instalador do aplicativo cliente deve verificar se a versão correta do MAPI está disponível no computador e se ela está configurada corretamente usando o arquivo Mapisvc.inf.
Métodos de implantação Aplicativos que usam MAPI podem ser implantados em computadores clientes usando tecnologias de distribuição de software padrão.
Notas de implantação The installer should verify that the correct version of MAPI is available.

Decision factors for the apps for Office platform

Because Suplementos do Office use web technologies, they are best for connecting to services in the cloud or on-premises, and bringing the services into the context of the rich client and web client. By requesting appropriate permissions, mail apps also allow reading, writing, or sending items in a mailbox.

The following are common reasons why mail apps are a better choice for developers than add-ins:

  • You can use existing knowledge of and the benefits of web technologies such as HTML, JavaScript, and CSS. For power users and new developers, XML, HTML, and JavaScript require less significant ramp-up time than COM-based APIs, including the object model and MAPI.

  • You can use a simple web deployment model to update your mail app (including the web services that the app uses) on your web server without any complex installation on the Outlook client. In fact, any updates to the mail app, with the exception of the app manifest, do not require any updating on the Office client. You can update the code or user interface of the mail app conveniently just on the web server. This presents a significant advantage over the administrative overhead involved in updating add-ins.

  • You can use a common web development platform for mail apps that can roam across the Outlook rich client and Outlook Web App on the desktop, tablet, and smartphone. On the other hand, add-ins use the object model for the Outlook rich client and, hence, can run on only that rich client on a desktop form factor.

  • You can enjoy rapid turnaround of building and releasing apps via the Office Store.

  • Because of the three-tier permissions model, users and administrators perceive better security and privacy in mail apps than add-ins, which have full access to the content of each account in the user's profile. This, in turn, encourages user consumption of apps.

  • Dependendo dos seus cenários, há recursos exclusivos de aplicativos de email que você pode aproveitar e que não são suportados pelos suplementos:

    • Você pode especificar um aplicativo de email para ativar apenas em certos contextos (por exemplo, o Outlook exibe o aplicativo na barra de aplicativos apenas se a classe de mensagem do compromisso selecionado pelo usuário for IPM.Appointment.Contoso ou se o corpo de um email contiver um número de rastreamento de pacote ou um identificador de cliente).

    • Você pode ativar um aplicativo de email se a mensagem selecionada contiver alguma entidade conhecida, como um endereço, contato, endereço de email, sugestão de reunião ou sugestão de tarefa.

    • Você pode tirar proveito da autenticação por tokens de identidade e de serviços Web do Exchange.

However, the following features are unique to add-ins and may make them a more appropriate choice than mail apps in some circumstances:

  • You can use add-ins to extend or automate Outlook at an application-level, because the object model and PIA have extensive integration with Outlook features (such as all Outlook item types, user interface, sessions, and rules). At the item-level, add-ins can interact with an item in read or compose mode. With mail apps, you cannot automate Outlook at the application level, and you can extend Outlook's functionality in the context of only the read-mode of the supported items (messages and appointments) in the user's mailbox.

  • You can specify custom business logic for a new item type.

  • Você pode modificar e adicionar comandos personalizados na faixa de opções e no modo de exibição Backstage.

  • Você pode exibir uma página de formulário ou região de formulário personalizada.

  • Você pode detectar eventos como enviar um item ou modificar as propriedades de um item.

  • Você pode usar os suplementos no Outlook 2013 e no Exchange Server 2013, além das versões anteriores do Outlook e do Exchange. Por outro lado, os aplicativos de email funcionam com o Outlook e o Exchange a partir do Outlook 2013 e do Exchange Server 2013, mas não funcionam com versões anteriores.

For more information about scenarios that the object model and PIA support, see the next section, Decision factors for the object model or PIA. For a comparison of the Suplementos do Office platform with other extensibility technologies for Office, see The background on apps for Office and SharePoint.

Fatores de decisão para o modelo de objeto ou PIA

Principais cenários de linha de base compatíveis com o modelo de objeto do Outlook ou PIA

Em geral, use o modelo de objeto ou o PIA se a sua solução personalizar a interface do usuário do Outlook ou se basear na lógica de negócios do Outlook. A seguir, os principais cenários de linha de base para os quais as soluções do Outlook usam o modelo de objeto ou o PIA.

Cenários compatíveis com o modelo de objeto ou PIA desde o Outlook 2007

Além dos cenários de linha de base, se sua solução do Outlook oferecer suporte a qualquer um dos cenários mostrados na lista a seguir e for executada no Outlook 2007 ou em versões posteriores, mas não em versões anteriores, você poderá usar o modelo de objeto ou o PIA também. Esta seção especifica os principais objetos ou membros que você pode usar no modelo de objeto do Outlook para estender cada cenário (com exceção da interface IDTExtensibility2 no modelo de objeto de automação do Visual Studio e da interface IRibbonExtensibility no modelo de objeto do Office, que você pode integrar com o modelo de objeto do Outlook).

Cenários compatíveis com o modelo de objeto ou PIA desde o Outlook 2010

Se a sua solução do Outlook se destina a ser executada no Outlook 2010 e não em versões anteriores, você poderá optar por usar o modelo de objeto ou o PIA para oferecer suporte aos cenários mostrados nesta próxima seção. Esta seção especifica os principais objetos ou membros que você pode usar no modelo de objeto do Outlook para estender cada cenário (com exceção das interfaces IRibbonControl, IRibbonExtensibility e IRibbonUI que estão no modelo de objeto do Office, que você pode integrar com o modelo de objeto do Outlook).

Cenários compatíveis com o modelo de objeto ou PIA desde o Outlook 2013

Se a sua solução se destina a ser executada no Outlook 2013 e não em versões anteriores, você pode usar o modelo de objeto ou o PIA para oferecer suporte aos cenários mostrados nos seguintes recursos.

Fatores de decisão para MAPI

Em geral, vcê usa o MAPI para acessar dados em um servidor baseado em MAPI, como o servidor Microsoft Exchange, e para executar tarefas como as seguintes:

  • Crie um provedor de serviços personalizado, como um provedor de catálogo de endereços, um provedor de transporte ou um provedor de loja.

  • Crie um processo de coletor.

  • Crie ou manipular um perfil.

  • Run an application as a Windows NT service.

  • Run tasks on a background thread. For example, enumerating numerous items in a folder and modifying the items' properties in a background thread can optimize performance.

For more information and code samples, see the Referência de MAPI do Outlook and MFCMAPI.

Além disso, se sua solução for executada em uma versão do Outlook anterior ao Outlook 2007 e cenários como os seguintes se aplicarem à sua solução, você deve usar o MAPI para estender esses cenários.

  • Definir e obter propriedades internas a nível do item que não são expostas no modelo de objeto.
  • Gerenciar contas, anexos, listas de distribuição do Exchange, usuários do Exchange ou lojas.
  • Armazenar dados privados para soluções.
  • Manage a message store for an account.

Since Outlook 2007, the object model has supported a range of features that, prior to Outlook 2007, developers had to resort to MAPI or other APIs such as Microsoft Collaboration Data Objects (CDO) 1.2.1 and Microsoft Exchange Client Extensions. So if any of the scenarios in the previous list applies to your solution, but your solution runs on Outlook 2007 or Outlook 2010, you can and should use the Outlook object model or PIA to support these scenarios. For more information about Outlook 2007 enhancements that unify Outlook development technologies, see What's New for Developers in Outlook 2007 (Part 1 of 2).

Fatores de decisão para as APIs auxiliares

The Outlook auxiliary APIs can integrate with Outlook business logic or MAPI in some scenarios where the object model or MAPI does not provide a solution. Use the Outlook auxiliary APIs in the following scenarios:

  • Account management: Manage account information, manipulate accounts, provide notification on account changes, and protect accounts from spam.
  • Degradação de dados: agrupe um objeto em um formato de caractere preferido em vez de expor o objeto em seu formato nativo.
  • Alteração de base de calendários e suporte a fuso horário: altere a base de calendários do Outlook para dar suporte ao horário de verão.
  • Status de disponibilidade: forneça informações de disponibilidade em calendários.
  • Imagens de contato: determine a exibição da imagem de um contato no Outlook.
  • Moeda do item: determine se um item do Outlook tem alterações não salvas.
  • Categorizar um item: categorize um item do Outlook depois de enviar o item.

For more information about the auxiliary APIs, see the Additional resourcesAuxiliary APIs section.

Automating Outlook by in-process vs. out-of-process Solutions

Observação

A discussão sobre a automação do Outlook nesta seção e na próxima está fora do escopo dos suplementos do Office, cujo objetivo é estender a funcionalidade do cliente ou aplicativo Web do Office, mas não para automatizá-lo.

Outlook supports automation by using add-ins that run in the same foreground process as the Outlook process, and by standalone solutions that run in their own separate process outside of the Outlook process. Generally, to automate Outlook, use an add-in to interact with Outlook through the object model, PIA, or MAPI, and in less common scenarios, through an auxiliary API (such as HrProcessConvActionForSentItem). Use an out-of-process solution only when it's necessary (for example, when you're writing a MAPI client application that uses the Tzmovelib.dll file to rebase Outlook calendars for customers, or enumerating numerous items in a folder and modifying the items' properties in a background thread to optimize performance).

Os suplementos são a solução preferida para automatizar o Outlook, pois o Outlook confia apenas no objeto Application passado para o suplemento durante o evento OnConnection(Object, ext_ConnectMode, Object, Array) do suplemento. Você pode evitar a exibição de avisos de segurança do Object Model Guard derivando todos os objetos, propriedades e métodos deste objeto Application . Se o suplemento criar uma nova instância do objeto Application , o Outlook não confiará nesse objeto, mesmo que o suplemento esteja na lista de suplementos confiáveis. Quaisquer objetos, propriedades e métodos derivados desse objeto Application não serão confiáveis e as propriedades e métodos bloqueados invocarão avisos de segurança. Para obter mais informações sobre o Outlook Object Model Guard, consulte Comportamento de segurança do Modelo de Objeto do Outlook.

Automação do Outlook por soluções gerenciadas versus não gerenciadas

Outlook supports automation by add-ins and standalone applications, written in managed or unmanaged languages. The more commonly used managed languages are C# and Visual Basic. C++ and Delphi tools are more common in unmanaged development. Available expertise is one consideration when choosing between managed and unmanaged development.

If your solution uses only the object model, you can consider developing a managed solution by using the PIA, or Office development tools in Visual Studio. The Office development tools in Visual Studio provide project templates and visual designers that simplify creating custom user interfaces and developing Office solutions.

On the other hand, because MAPI was developed years before the .NET Framework, and Microsoft does not provide managed wrappers for MAPI, Microsoft does not support using MAPI in managed code. If you are using MAPI, you must develop an unmanaged solution. For more information, see The support guidelines for client-side messaging development.

APIs e tecnologias de nicho

O Outlook Social Connector (OSC) e a Barra do Tempo suportam a extensão de cenários muito específicos no Outlook.

Outlook Social Connector (OSC) provider extensibility

The Outlook Social Connector (OSC) provider extensibility supports developing a provider for a social network to allow users to view, in Outlook and other Office client applications, friends and activities updates on that social network. Figure 6 shows the OSC displaying in the People Pane the activities of a person in social network sites.

Figura 6. O OSC que exibe dados de rede social no painel Pessoas

Painel do Outlook Social Connector

The OSC in Outlook allows users to view, in the People Pane, an aggregation of emails, attachments, and meeting requests from a person in Outlook. In an organizational environment, users who collaborate on a SharePoint site can see document updates and other site activities of this person on the SharePoint site. Outlook Social Connector provider extensibility supports developing a provider for the OSC to synchronize and surface social network updates in Outlook. Common OSC providers (such as Facebook and LinkedIn) are installed by default with Outlook. Depending on the social network sites that an Outlook user has signed into, the user can see, in the People Pane, updates such as photos, status, and activities on the corresponding social networks.

Weather Bar extensibility

Starting in Outlook 2013, the Weather Bar allows developers to plug in a third-party weather web service for the Weather Bar, to provide weather conditions data for a user-chosen location. The Weather Bar in Outlook displays weather conditions and forecast for a geographic location. A user can choose one or multiple locations, and conveniently see weather data in the Weather Bar in the calendar module. Figure 7 shows the Weather Bar displaying a three-day forecast for New York, NY.

Figura 7. Barra do Tempo no Outlook

Barra do tempo mostrando a previsão de Nova York.

By default, Outlook uses weather data provided by MSN Weather. The Weather Bar supports third-party weather data web services which follow a defined protocol to communicate with Outlook. As long as a third-party weather data service supports this protocol, users can choose that weather data service to provide weather data in the Weather Bar.

See the Additional resourcesprimary references, resources, and code samples section for more information about using OSC provider extensibility and the Weather Bar extensibility.

Conclusão

Para determinar a melhor API ou tecnologia para a sua solução, primeiro você deve definir os objetivos da sua solução:

  • The versions of Outlook you intend your solution to support.

  • The high-priority scenarios of your solution. Does your solution mainly interact with the content and properties of a message or appointment item? Or does your solution automate Outlook at an application level? If so, do these scenarios involve enumerating, filtering, or modifying folders that contain many Outlook items?

First, verify whether the mail app support in the Suplementos do Office platform meets your needs. See the Functional Criteria section of Objective evaluation criteria for the apps for Office platform to determine whether the major objects and features support your scenarios. See the section Decision factors for the apps for Office platform to verify whether mail apps are a better choice than add-ins for your scenarios. In general, develop your solution as an app, if possible, to take advantage of the platform's support across Outlook clients over different form factors.

If your scenarios require you to extend beyond message and appointment items, or require you to automate Outlook at an application level, try to match your scenarios with those outlined in the section Decision factors for the object model or PIA. If the object model (or PIA) of your target Outlook versions supports your scenarios, and your solution does not manipulate folders with many items, you should implement your solution as an add-in, in either a managed or unmanaged language.

If the object model (or PIA) of a target Outlook version does not support some of your scenarios, verify whether the scenarios in the Decision factors for MAPI or Decision factors for the Auxiliary APIs section meet your needs. If MAPI meets your needs, you should implement your solution in unmanaged code. If an auxiliary API solves one of your scenarios, you can use managed or unmanaged code.

If your solution uses MAPI, you must implement it in unmanaged code, such as C++. Otherwise, the decision to use managed or unmanaged code to create the solution generally depends on your available resources and their expertise. As for deciding whether to implement the solution as an add-in or standalone application, choose an add-in to avoid the user constantly invoking the Outlook Object Model Guard, unless your scenario requires manipulation of folders that contain numerous items. In the latter scenario, implementing the solution to run as a background thread can optimize Outlook performance.

If your scenarios include showing social network information or updates in Outlook, you should use the OSC provider extensibility to create a COM-visible DLL. You can do this in either a managed or unmanaged language.

If you are interested in plugging in a third-party weather data service to the Weather Bar, you can follow the protocol defined by Weather Bar extensibility and provide the appropriate web services. You can create these web services in a managed language.

Depois de decidir quais são as APIs ou tecnologias para usar em sua solução, você pode conferir a documentação adicional e exemplos de códigona seção Recursos adicionais — referências principais, recursos e exemplos de códigos para saber mais.

Visão geral da plataforma de suplementos do Office fornece uma boa introdução de suplementos do Office, incluindo o ciclo de vida da arquitetura e do desenvolvimento.

Confira Suplementos do Outlook para ver um roteiro detalhado de recursos sobre o desenvolvimento de aplicativos de email.

Confira também: PIA e modelo de objeto

Os recursos a seguir fornecem mais informações sobre como usar o modelo de objeto e o PIA.

Contas — várias contas no perfil

Usuários do catálogo de endereços e do Exchange

Anexos

Anexos: seleção no inspetor

Automatizando o Outlook

Categorias

Contatos: verifique o endereço e o nome completo

Conversas

Eventos

Explorador: resposta embutida

Itens: campos, formulários e propriedades básicas

Itens: personalizando propriedades

Itens: enumerando, filtrando e classificando

Itens: sinalizar como tarefas

Veja as seguintes propriedades relacionadas a tarefas em alguns objetos de item, como objeto MailItem:

Itens: seleção no explorer

Diversos: cartões de visita, regras e visualizações

Segurança

Compartilhamento

Soluções: pastas de solução específica

Soluções: armazenando dados

Interface do usuário: personalizando áreas de formulário

Interface do usuário: personalização desde o Outlook 2007

Interface do usuário: personalização desde o Outlook 2010

Interface do usuário: pastas de solução específica

Confira também: APIs auxiliares

Os recursos a seguir fornecem mais informações sobre as APIs auxiliares do Outlook.

Account management

Categorizing items

Imagens de contatos

Degradação de dados

Status de disponibilidade

Moeda do item

Trocar a base de calendários

Confira também: recursos, exemplos de código e referências principais

Os recursos a seguir fornecem mais informações sobre as principais referências, recursos e exemplos de código do Outlook.

Principais recursos e referências

Exemplos de código