Printer Friendly Version      Send     
Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Reference
 RemoveCustomization Method (2003 S...
Visual Studio Tools for Office API Reference
ServerDocument..::.RemoveCustomization Method (2003 System)

Updated: November 2007

Removes the Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0) customization from the document.

Namespace:  Microsoft.VisualStudio.Tools.Applications.Runtime
Assembly:  Microsoft.VisualStudio.Tools.Applications.Runtime (in Microsoft.VisualStudio.Tools.Applications.Runtime.dll)
Visual Basic (Declaration)
Public Shared Sub RemoveCustomization ( _
    documentPath As String _
)
Visual Basic (Usage)
Dim documentPath As String

ServerDocument.RemoveCustomization(documentPath)
C#
public static void RemoveCustomization(
    string documentPath
)

Parameters

documentPath
Type: System..::.String
The full path of the document from which you want to remove the customization.
ExceptionCondition
ArgumentNullException

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

FileNotFoundException

The file specified by documentPath does not exist.

IOException

The file specified by documentPath is read-only, or cannot be accessed.

InvalidOperationException

The file specified by documentPath does not have a Visual Studio Tools for Office customization, or an error occurred while loading the manifest.

This method clears the application manifest and the cached data manifest, and removes any cached data from the document. For more information, see How to: Remove Managed Code Extensions from Documents (2003 System).

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.

Visual Basic
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

C#
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.");
    }
}

© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker