ItemOperations Interface

Object for performing common file actions.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
<GuidAttribute("D5DBE57B-C074-4E95-B015-ABEEAA391693")> _
Public Interface ItemOperations
'Usage
Dim instance As ItemOperations
[GuidAttribute("D5DBE57B-C074-4E95-B015-ABEEAA391693")]
public interface ItemOperations
[GuidAttribute(L"D5DBE57B-C074-4E95-B015-ABEEAA391693")]
public interface class ItemOperations
public interface ItemOperations

Remarks

You can use the ItemOperations object to programmatically open or add items to your solution and projects. Note that ItemOperations methods act upon only the currently selected item.

This example uses the ItemOperations object to generate a text document listing all available command names.

Examples

Sub ItemOperationsExample()
   Dim Cmds As Commands = DTE.Commands
   Dim Cmd As Command
   Dim Doc As Document
   Dim TxtDoc As TextDocument

   DTE.ItemOperations.NewFile("General\Text File")
   Doc = ActiveDocument
   TxtDoc = Doc.Object("TextDocument")

   For Each Cmd In Cmds
      If (Cmd.Name <> "") Then
         TxtDoc.Selection.Text = Cmd.Name & vbLf
         TxtDoc.Selection.Collapse()
      End If
   Next
End Sub

See Also

Reference

ItemOperations Members

EnvDTE Namespace