|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Office Solutions Development Overview
By using Microsoft Office 2003 or the 2007 Microsoft Office system as the front end for solutions, you can take advantage of the familiar Microsoft Office user interfaces and built-in tools such as spell checking, change tracking, and e-mail support. Your users can take Microsoft Office solutions offline, which makes complex solutions more practical than they would be using a Web-based architecture.
For general information about how to develop with Microsoft Office, see Managed Code and Office Programming with Visual Studio, and the Microsoft Office Developer Center.
You can programmatically incorporate the features of Microsoft Office applications into your solution by writing code that accesses an application's object model. Object models are an arrangement of classes that expose functionality through various properties and methods. The object model for each Microsoft Office application is different.
To use the features of a Microsoft Office application from a Visual Studio Tools for Office solution, you must use the primary interop assembly for the application. The primary interop assembly enables managed code to interact with an Office application's COM-based object model.
For more information, see Managed Code and Office Programming with Visual Studio and Office Primary Interop Assemblies.
Visual Studio Tools for Office provides the following types of project templates:
SharePoint workflow templates.
InfoPath form templates.
To decide which of these project types is best for your solution, think about whether you want your code to run only when a specific document is open, or whether you want the code to be available whenever the Microsoft Office application is running. For more information about the project templates, see Visual Studio Tools for Office Project Templates Overview.
The types of projects you can create depend on which Microsoft Office applications you have installed on the development computer. For more information, see Features Available by Application and Project Type.
Document-level customizations consist of an assembly that is associated with a single document, workbook, or template in Microsoft Office Word or Microsoft Office Excel. The assembly is loaded when the associated document is opened. Features in customizations that you create are available only when the associated document is open. Customizations cannot make application-wide changes, such as displaying a new menu item or Ribbon tab when any document is open.
Visual Studio Tools for Office includes tools to help you create customizations in Visual Studio. The document that you customize is hosted as a design surface in Visual Studio, which enables you to design the document by dragging and dropping controls onto it. Many other Visual Studio features are available in document-level projects, such as Windows Forms controls, data binding, and an integrated debugger.
For more information about customizations, see Getting Started Programming Document-Level Customizations for Excel, Getting Started Programming Document-Level Customizations for Word, and Architecture of Document-Level Customizations.
Application-level add-ins consist of an assembly that is associated with a Microsoft Office application. Typically, the add-in runs when the associated application is started, although users can also load add-ins after the application is already running. Features in add-ins that you create are available to the application itself, regardless of which documents are open.
Visual Studio Tools for Office includes tools to help you create add-ins in Visual Studio. Add-in projects include an automatically generated class that represents the add-in. This class provides properties and events you can use to access the object model of the host application and run code when the add-in is loaded and shut down. Many other Visual Studio features are available in application-level projects, such as Windows Forms and an integrated debugger.
For more information about add-ins, see Getting Started Programming Application-Level Add-Ins and Architecture of Application-Level Add-Ins.
SharePoint Workflow Templates
Visual Studio Tools for Office provides tools to help you create custom workflow templates that manage the life cycle of documents and list items in a SharePoint Web site. Visual Studio Tools for Office includes a workflow designer, a complete set of drag-and-drop activity controls, and the necessary assembly references. You start a project by using the New Office SharePoint Workflow wizard, which significantly reduces the configuration steps that are required to debug the workflow template in Visual Studio.
For more information about SharePoint workflow templates, see SharePoint Workflow Solutions.
InfoPath Form Templates
Visual Studio Tools for Office provides tools to help you create form templates for InfoPath 2007. The InfoPath form template design environment is fully integrated into the Visual Studio development environment. You can work with the features of InfoPath 2007 to design the look of your InfoPath form template at the same time that you write managed code to extend its capabilities without leaving Visual Studio. When you work with InfoPath form templates in Visual Studio, you write business logic in Visual C# or Visual Basic against either the InfoPath 2003-compatible object model (members of the Microsoft.Office.Interop.InfoPath.SemiTrust namespace) or the new InfoPath 2007 managed code object model (members of the Microsoft.Office.InfoPath namespace).
For more information, see Developing InfoPath Managed Code Form Templates.
When you design an Office solution, consider how the deployment requirements might affect your development choices.
Deployment and Maintenance
Visual Studio Tools for Office solutions can be deployed in several different ways. Application-level add-ins and document-level customizations for the 2007 Microsoft Office system can be deployed by using ClickOnce. ClickOnce deployment enables you to create self-updating solutions that can be installed and run with minimal user interaction. For more information, see Deploying Office Solutions (2007 System).
Add-ins and customizations for Microsoft Office 2003 can be deployed by storing the assembly (and the document, if applicable for the type of solution) in a shared location for easy maintenance, or by distributing copies of the assembly and document to each user to handle mobile work styles. For more information, see Deploying Office Solutions (2003 System).
Visual Studio Tools for Office does not provide tools for deploying SharePoint workflow templates. For more information, see SharePoint Workflow Solutions.
Security for application-level add-ins and document-level customizations for the 2007 Microsoft Office system is enforced by a series of checks that the Visual Studio Tools for Office runtime makes when it installs and loads the solution. These checks include verifying whether the location of the deployment manifest is trusted, whether the certificate used to sign the deployment manifest is trusted, and whether the solution is in an inclusion list. For more information, see Security in Office Solutions (2007 System).
Security for Microsoft Office 2003 solutions is enforced by security features in the .NET Framework. The default policy for assemblies created by using Visual Studio Tools for Office does not allow any assembly to run, which helps protect users from viruses and other malicious code. Before end users can use your solution, the administrator must explicitly grant full trust to the assembly. For more information, see Security in Office Solutions (2003 System).