Yes, given a ProjectItem, ProjectItem.Collection returns the ProjectItems
collection it belongs to (do not confuse with ProjectItem.ProjectItems,
which is the collection of children), and then ProjectItems.Parent returns
the object parent , which can be a Project (you are done) or a ProjectItem
(such a folder, or a file which depends on, etc.). In the later case you
enter in recursion, etc.

Signature
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
> Yeah, but since i need to construct the virtual path I'll need the
> predecessor of a projectitem in the project tree.
manfred.mail@gmx.at - 17 Aug 2005 16:16 GMT
Thanks for your help, but there is still a problem. As you mentioned,
ProjectItem.Collection returns the ProjectItems collection it belongs
to. But unfortunately this may not be the parent ProjectItem.
e.g. I need to calculate the virtual path to the selected project item
and therefore i retrieve my ProjectItems this way:
Dim proj as ProjectItem
Dim item As SelectedItem
For Each item In DTE.SelectedItems
proj = item.ProjectItem
...
Next
I have tried this, but the proj.Collection.Parent points to the DTE
object, not to the predecessor of the current ProjectItem in the tree.
Best regards,
Manfred
Carlos J. Quintero [VB MVP] - 18 Aug 2005 09:39 GMT
Hummm, interesting. It could be because you are getting the ProjectItem from
the DTE.SelectedItems collection, because if you get it from the
Solution.Projects, Project.ProjectItems, etc. it should work fine. Not sure
it this will work, but you could try to retrieve a ProjectItem whose parents
are more meaningful using:
myProjectItem = DTE.Solution.FindProjectItem(item.ProjectItem.FileNames(0))'
That is, FindProjectItem retrieves a ProjectItem from the solution given its
file name. Hopefully its parents are correct this time.

Signature
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
> Thanks for your help, but there is still a problem. As you mentioned,
> ProjectItem.Collection returns the ProjectItems collection it belongs
[quoted text clipped - 18 lines]
> Best regards,
> Manfred
manfred.mail@gmx.at - 19 Aug 2005 07:45 GMT
If've tested the code above but it seems that it doesn't work either
because when i retrieve my ProjectItem with the
Solution.FindProjectItem method, the myProjectItem.Collection property
is always nothing.
Best regards,
Manfred