Partilhar via


ItemOperations.NewFile(String, String, String) Method

Definition

Creates a file as though you invoked a New File command in the integrated development environment (IDE).

EnvDTE::Window NewFile(std::wstring const & Item = "General\Text File", std::wstring const & Name = "", std::wstring const & ViewKind = "{00000000-0000-0000-0000-000000000000}");
[System.Runtime.InteropServices.DispId(4)]
public EnvDTE.Window NewFile (string Item = "General\Text File", string Name = "", string ViewKind = "{00000000-0000-0000-0000-000000000000}");
[<System.Runtime.InteropServices.DispId(4)>]
abstract member NewFile : string * string * string -> EnvDTE.Window
Public Function NewFile (Optional Item As String = "General\Text File", Optional Name As String = "", Optional ViewKind As String = "{00000000-0000-0000-0000-000000000000}") As Window

Parameters

Item
String

Required. 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
String

Optional. 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
String

Optional. A ConstantsvsViewKind* constant specifying the type of view in which to create the file.

Returns

A Window object.

Attributes

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  

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.

Applies to