Share via


IEditorOperations.InsertFile Method

Inserts the contents of a file on disk into the text buffer.

Namespace:  Microsoft.VisualStudio.Text.Operations
Assembly:  Microsoft.VisualStudio.Text.UI (in Microsoft.VisualStudio.Text.UI.dll)

Syntax

'Declaration
Function InsertFile ( _
    filePath As String _
) As Boolean
bool InsertFile(
    string filePath
)
bool InsertFile(
    String^ filePath
)
abstract InsertFile : 
        filePath:string -> bool
function InsertFile(
    filePath : String
) : boolean

Parameters

Return Value

Type: System.Boolean
true if the edit succeeded, otherwise false.

Exceptions

Exception Condition
DirectoryNotFoundException

The specified path is invalid (for example, it is on an unmapped drive).

ArgumentException

filePath is a zero-length string, contains only white space, or contains one or more invalid characters as defined by GetInvalidPathChars.

FileNotFoundException

The file specified in filePath was not found.

SecurityException

The caller does not have the required permission.

PathTooLongException

The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.

UnauthorizedAccessException

filePath specifies a file that is read-only, or this operation is not supported on the current platform, or filePath specifies a directory, or the caller does not have the required permission.

IOException

An I/O error occurred while opening the file.

ArgumentNullException

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

NotSupportedException

filePath is in an invalid format.

.NET Framework Security

See Also

Reference

IEditorOperations Interface

Microsoft.VisualStudio.Text.Operations Namespace