ServerDocument::IsCacheEnabled Method (String^)
Gets a value that indicates whether the specified document has a data cache.
Assembly: Microsoft.VisualStudio.Tools.Applications.ServerDocument (in Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll)
Parameters
- documentPath
-
Type:
System::String^
The full path of the document that you want to check.
Return Value
Type: System::Booleantrue if the specified document has a data cache; otherwise, false.
| 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). |
This method indicates only whether the document has a data cache, not whether the data cache actually contains data. If the document has a data cache that contains no data in it, this method still returns true.
The following code example creates a new ServerDocument, and then uses the CachedData property to display the contents of the data cache. The example first uses the IsCacheEnabled method to verify that the workbook has a data cache.
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.