Expand Minimize

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)

bool InsertFile(
	string filePath
)

Parameters

filePath
Type: System.String

The path of the file on disk.

Return Value

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

ExceptionCondition
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 null.

NotSupportedException

filePath is in an invalid format.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft