Share via


ServerDocument.IsCustomized Method (2003 System)

Gets a value that indicates whether the specified document has a Visual Studio Tools for Office customization.

Namespace:  Microsoft.VisualStudio.Tools.Applications.Runtime
Assembly:  Microsoft.VisualStudio.Tools.Applications.Runtime (in Microsoft.VisualStudio.Tools.Applications.Runtime.dll)

Syntax

'Declaration
Public Shared Function IsCustomized ( _
    documentPath As String _
) As Boolean
'Usage
Dim documentPath As String
Dim returnValue As Boolean

returnValue = ServerDocument.IsCustomized(documentPath)
public static bool IsCustomized(
    string documentPath
)

Parameters

  • documentPath
    Type: System.String
    The path of the document that you want to check for a customization.

Return Value

Type: System.Boolean
true if the document has a Visual Studio Tools for Office customization; otherwise, false.

Exceptions

Exception Condition
ArgumentNullException

The documentPath parameter is nulla null reference (Nothing in Visual Basic) or empty or consists entirely of white space characters.

FileNotFoundException

The file in documentPath does not exist.

Remarks

This method returns true if the document has an application manifest that points to a customization assembly and at least one entryPoint element. The entryPoint element specifies the class that is instantiated when the document is opened. Documents that are associated with an assembly but do not have any entryPoint elements do not execute code and are not considered customized. For more information, see <entryPoint> Element (Visual Studio Tools for Office Reference).

Examples

The following code example uses the RemoveCustomization method to remove the customization from the specified document. The example first calls the IsCustomized method to determine whether the document has a Visual Studio Tools for Office customization. This example requires a reference to the Microsoft.VisualStudio.Tools.Applications.Runtime assembly, and an Imports (for Visual Basic) or using (for C#) statement for the Microsoft.VisualStudio.Tools.Applications.Runtime namespace at the top of your code file.

Private Shared Sub Remove(ByVal fileName As String)
    If ServerDocument.IsCustomized(fileName) Then
        ServerDocument.RemoveCustomization(fileName)
        MsgBox("The customization has been removed.")
    Else
        MsgBox("The specified document is not " + _
            "customized.")
    End If
End Sub
private static void Remove(string fileName)
{
    if (ServerDocument.IsCustomized(fileName))
    {
        ServerDocument.RemoveCustomization(fileName);
        MessageBox.Show("The customization has been removed.");
    }
    else
    {
        MessageBox.Show("The specified document is not " +
            "customized.");
    }
}

Permissions

See Also

Reference

ServerDocument Class

ServerDocument Members

Microsoft.VisualStudio.Tools.Applications.Runtime Namespace