ItemOperations.NewFile Method
Creates a file as though you invoked a New File command in the integrated development environment (IDE).
Namespace: EnvDTE
Assembly: EnvDTE (in EnvDTE.dll)
Syntax
'Declaration
Function NewFile ( _
Item As String, _
Name As String, _
ViewKind As String _
) As Window
Window NewFile(
string Item,
string Name,
string ViewKind
)
Window^ NewFile(
[InAttribute] String^ Item,
[InAttribute] String^ Name,
[InAttribute] String^ ViewKind
)
abstract NewFile :
Item:string *
Name:string *
ViewKind:string -> Window
function NewFile(
Item : String,
Name : String,
ViewKind : String
) : Window
Parameters
Item
Type: System.StringRequired. The virtual path to the item based on the tree nodes from the left pane of the dialog box and the item name from the right pane.
Name
Type: System.StringOptional. The name you type in the Default Name box in the dialog box. This name also becomes the suggested Save As name when you save the document.
ViewKind
Type: System.StringOptional. A ConstantsvsViewKind* constant specifying the type of view in which to create the file.
Return Value
Type: EnvDTE.Window
A Window object.
Remarks
NewFile models the New File dialog box. The contents of this dialog box vary depending on the type of project. To add items to a project by using this method, look at the items available for the project in the New File dialog box.
Examples
Sub NewFileExample()
Dim ItemOp As ItemOperations
ItemOp = DTE.ItemOperations
' Adds a new text document to the project.
ItemOp.NewFile("General\Text File", "Some name", _
Constants.vsViewKindTextView)
End Sub
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.