Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Managing Documents on a Server by Using the ServerDocument Class

Applies to

The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.

Project type

  • Document-level projects

Microsoft Office version

  • 2007 Microsoft Office system

  • Microsoft Office 2003

For more information, see Features Available by Application and Project Type.

You can use the ServerDocument class to manage several aspects of document-level customizations, even if Microsoft Office Word and Microsoft Office Excel are not installed. You can perform the following tasks:

There are two different versions of the ServerDocument class, one for each version of the Visual Studio Tools for Office runtime. Use the one that corresponds to the solution's version of Microsoft Office:

  • Use the Microsoft.VisualStudio.Tools.Applications.ServerDocument class with customizations for Excel 2007 and Word 2007. This class is provided by the Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime).

  • Use the ServerDocument class with customizations for Excel 2003 and Word 2003. This class is provided by the Visual Studio 2005 Tools for Office Second Edition runtime.

Although the two versions of the ServerDocument class share much of the same functionality, there are differences in namespaces, assemblies, and members. For more information, see Understanding ServerDocument Differences.

The ServerDocument class is designed to work on computers that do not have Microsoft Office installed. Therefore, you typically use this class in projects that do not integrate with Microsoft Office, such as Console projects or Windows Forms projects, rather than Visual Studio Tools for Office projects.

For more information about the different versions of the Visual Studio Tools for Office runtime, see Visual Studio Tools for Office Runtime Overview.

Both versions of the ServerDocument class provide members you can use to work with the data cache in customized documents. For more information about cached data, see Caching Data and Accessing Data in Documents on the Server.

The following table lists the members you can use to work with cached data.

Task

Excel 2007 and Word 2007 projects

Excel 2003 and Word 2003 projects

To determine whether a document has a Visual Studio Tools for Office data cache.

The IsCacheEnabled method in the Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime).

The IsCacheEnabled(String) method in the Visual Studio 2005 Tools for Office Second Edition runtime.

To access the cached data in a document.

For more information, see Accessing Data in Documents on the Server.

The CachedData property in the Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime).

The CachedData property in the Visual Studio 2005 Tools for Office Second Edition runtime.

You can use members of the ServerDocument class to manage the Visual Studio Tools for Office customization for a document. For example, you can programmatically remove the customization from a document so that the document is no longer part of a Visual Studio Tools for Office customization.

The following table lists the members you can use to manage the customization assembly.

Task

Excel 2007 and Word 2007 projects

Excel 2003 and Word 2003 projects

To determine whether a document has a Visual Studio Tools for Office customization.

The GetCustomizationVersion method in the Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime).

The IsCustomized(String) method in the Visual Studio 2005 Tools for Office Second Edition runtime.

To programmatically attach a customization to a document at run time.

For more information, see:

One of the AddCustomization methods in the Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime).

One of the AddCustomization methods in the Visual Studio 2005 Tools for Office Second Edition runtime.

To programmatically remove a customization from a document at run time.

For more information, see:

The RemoveCustomization method in the Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime).

The RemoveCustomization(String) method in the Visual Studio 2005 Tools for Office Second Edition runtime.

To get the URL of the deployment manifest that is associated with the document.

The DeploymentManifestUrl property in the Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime).

The Visual Studio 2005 Tools for Office Second Edition runtime does not include this property, because the deployment manifest is optional with document-level solutions for Excel 2003 and Word 2003; instead, these solutions always have an embedded application manifest.

To access the application manifest that is embedded in the document.

The Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime) does not include this property, because document-level solutions for Excel 2007 and Word 2007 do not have an embedded application manifest.

The AppManifest property in the Visual Studio 2005 Tools for Office Second Edition runtime.

The two versions of the ServerDocument class and the related classes that provide the object model for cached data (such as CachedDataHostItem and CachedDataItem) are defined in different assemblies and namespaces. In addition, some members and method overloads are provided in only one version of the class. You should be aware of these differences in the following scenarios:

  • You want to migrate code that uses the ServerDocument class in the Visual Studio 2005 Tools for Office Second Edition runtime so that it works with Excel 2007 and Word 2007 solutions.

  • You want to use the ServerDocument class in code that works with document-level customizations for both Microsoft Office 2003 and the 2007 Microsoft Office system.

For an example that demonstrates how to use both versions of the ServerDocument class in the same code, see How to: Write Code that Uses Both Versions of the ServerDocument Class.

Namespace and Assembly Differences

The following table lists the namespace and assembly differences for the two versions of the ServerDocument class and the classes that provide the object model for cached data.

Runtime version

Namespace

Assembly

Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime)

Microsoft.VisualStudio.Tools.Applications

Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0.dll

Visual Studio 2005 Tools for Office Second Edition runtime

Microsoft.VisualStudio.Tools.Applications.Runtime

Microsoft.VisualStudio.Tools.Applications.Runtime.dll

Member Differences

The following members are provided only in the ServerDocument class in the Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime):

The following members are provided only in the ServerDocument class in the Visual Studio 2005 Tools for Office Second Edition runtime:

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft