Export (0) Print
Expand All

ProjectItem Interface

Represents an item in a project.

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

[GuidAttribute("0B48100A-473E-433C-AB8F-66B9739AB620")]
public interface ProjectItem

The ProjectItem type exposes the following members.

  NameDescription
Public propertyCollectionGets the ProjectItems collection containing the ProjectItem object supporting this property.
Public propertyConfigurationManagerGets the ConfigurationManager object for this ProjectItem.
Public propertyContainingProjectGets the project hosting the ProjectItem.
Public propertyDocumentGets the Document associated with the item, if one exists.
Public propertyDTEGets the top-level extensibility object.
Public propertyExtenderGets the requested Extender if it is available for this object.
Public propertyExtenderCATIDGets the Extender category ID (CATID) for the object.
Public propertyExtenderNamesGets a list of available Extenders for the object.
Public propertyFileCodeModelGets the FileCodeModel object for the project item.
Public propertyFileCountGets the number of files associated with a ProjectItem.
Public propertyFileNamesGets the full path and names of the files associated with a project item.
Public propertyIsDirtyInfrastructure. Microsoft Internal Use Only.
Public propertyIsOpenGets a value indicating whether the project item is open in a particular view type.
Public propertyKindGets a GUID string indicating the kind or type of the object.
Public propertyNameGets or sets the name of the object.
Public propertyObjectGets an object that can be accessed by name at run time.
Public propertyProjectItemsGets a ProjectItems for the object.
Public propertyPropertiesGets a collection of all properties that pertain to the object.
Public propertySavedGets or sets a value indicating whether or not the object has been modified since last being saved or opened.
Public propertySubProjectIf the project item is the root of a subproject, then the SubProject property returns the Project object for the subproject.
Top

  NameDescription
Public methodDeleteRemoves the item from its project and its storage.
Public methodExpandViewExpands the view of Solution Explorer to show project items.
Public methodOpenOpens the ProjectItem in the specified view.
Public methodRemoveRemoves the project item from the collection.
Public methodSaveSaves the project or project item.
Public methodSaveAsSaves the project item.
Top

' Before running, create a new project or open an existing project.
Sub ListProj()
   Dim proj As Project = DTE.ActiveSolutionProjects(0)
   Dim win As Window = _
     DTE.Windows.Item(Constants.vsWindowKindCommandWindow)
   ListProjAux(proj.ProjectItems(), 0)
End Sub

Sub ListProjAux(ByVal projitems As ProjectItems, ByVal Level As Integer)
   Dim projitem As ProjectItem
   For Each projitem In projitems
      MsgBox("Project item: " & projitem.Name, Level)
      ' Recurse if the project item has sub-items...
      Dim projitems2 As ProjectItems
      projitems2 = projitem.ProjectItems
      Dim notsubcoll As Boolean = projitems2 Is Nothing
      If Not notsubcoll Then
         ListProjAux(projitems2, Level + 1)
      End If
   Next
End Sub

Community Additions

ADD
Show:
© 2014 Microsoft