ServerDocument Constructor (String^)
Initializes a new instance of the ServerDocument class using the full path of the document to be loaded.
Assembly: Microsoft.VisualStudio.Tools.Applications.ServerDocument (in Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll)
Parameters
- documentPath
-
Type:
System::String^
The full path of the document to be loaded.
| Exception | Condition |
|---|---|
| ArgumentNullException | The documentPath parameter is null or empty or consists entirely of white space characters. |
| FileNotFoundException | The file specified by documentPath does not exist. |
| DocumentCustomizedWithPreviousRuntimeException | The file specified by documentPath has a customization that was not created with the Visual Studio 2010 Tools for Office Runtime or the Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime). |
| UnknownCustomizationFileException | The file specified by documentPath has a file name extension that is not supported by the Visual Studio Tools for Office runtime. |
Use this constructor to access the cached data or deployment manifest information in a document that is on disk. When you use this constructor, the specified document is opened with read/write access.
The following code example uses the ServerDocument(String^) constructor to create a new ServerDocument that loads a specified document. The example then displays the URL of the deployment manifest for the customization that is attached to the document.
This example requires:
A console application project or some other non-Office project.
References to the following assemblies:
Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll and Microsoft.VisualStudio.Tools.Applications.Runtime.dll (if the project targets the .NET Framework 4 or the .NET Framework 4.5).
or
Microsoft.VisualStudio.Tools.Applications.ServerDocument.v10.0.dll and Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0.dll (if the project targets the .NET Framework 3.5).
Imports (for Visual Basic) or using (for C#) statements for Microsoft.VisualStudio.Tools.Applications and Microsoft.VisualStudio.Tools.Applications.Runtime namespaces at the top of your code file.