ITextDocument.SaveCopy Method (String, Boolean)

Saves the contents of the TextBuffer to the given filePath.

Namespace:  Microsoft.VisualStudio.Text
Assembly:  Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)

Syntax

'Declaration
Sub SaveCopy ( _
    filePath As String, _
    overwrite As Boolean _
)
void SaveCopy(
    string filePath,
    bool overwrite
)
void SaveCopy(
    String^ filePath, 
    bool overwrite
)
abstract SaveCopy : 
        filePath:string * 
        overwrite:bool -> unit
function SaveCopy(
    filePath : String, 
    overwrite : boolean
)

Parameters

  • filePath
    Type: String

    The name of the file.

  • overwrite
    Type: Boolean

    true if filePath should be overwritten if it exists, otherwise false.

Exceptions

Exception Condition
ArgumentNullException

filePath is nulla null reference (Nothing in Visual Basic).

UnauthorizedAccessException

An access error occurred during file save.

IOException

An I/O error occurred (including an error caused by attempting to overwrite an existing file when overwrite is false).

ObjectDisposedException

This object has been disposed.

Remarks

This call does not affect the IsDirty, LastSavedTime, and FilePath properties.

The FileActionOccurred event is not raised.

.NET Framework Security

See Also

Reference

ITextDocument Interface

SaveCopy Overload

Microsoft.VisualStudio.Text Namespace