Programmatically Insert a Subproject

M

Marc

We're using Project Server 2007, and it's been requested to have a
"Project Wizard" that will be used to create a master project and then
subprojects for this master project based on the user's selections --
basically, they just select the products they want to create a project
for, and the wizard creates the master project and subprojects for
each selected product, and then inserts them into the master project.
In theory! :)

I have it doing essentially everything except inserting the
subprojects into the master project. When the master project is
opened in Project Pro, the subprojects have successfully been inserted
as tasks, but that's all they are, they don't link to the subproject
itself. The following looks to be correct so far:

- The PROJ_TYPE is set correctly for the master (6) and subprojects
(5).
- The tasks' rows in MSP_TASKS do reference the subprojects' GUIDs and
"first" task GUIDs.
- The subprojects and master project are setup in the
MSP_PROJ_HIERARCHIES table.

I can't find any other relationships I need to setup, but am sure I'm
missing something.

I've been comparing against another master/subproject set that was
created from MS Project Pro 2007 and published out to Project Server,
and don't see any differences yet between the Project Pro-created ones
and the ones I'm building programmatically, yet when I open the
programmatically-created master project in Project Pro, the
subprojects are listed just as tasks.

Any ideas? I know what I'm doing is unsupported :)

Thanks!

Marc
 
R

Rod Gill

The only safe way to do this is using automation and inserting projects.
Record a macro of you manually creating a master project and use that code.
Inserting tasks directly into the draft database is not only unsupported,
but is likely to break after upgrading to the next SP or even hotfixes.
Microsoft has reserved the right to change the databases (except reporting
db) with any service pack or hotfix.

--

Rod Gill
Project MVP

Project VBA Book, for details visit:
http://www.projectvbabook.com

NEW!! Web based VBA training course delivered by me. For details visit:
http://projectservertraining.com/learning/index.aspx
 
M

Marc

Yeah, I knew it was unsupported and could possibly break, was just
hoping to not have to go the VB route (I'm a web-based guy ;) Anyway,
thanks for your response...I started looking through the VB stuff
yesterday, so I'm going to try to get that working.

I was hoping I'd be able to do a web-based app where they can get
everything selected, have their projects built (there's some
interdependencies between the subprojects), publish them out, and then
when they opened them in Project, everything would be there. I should
be able to do something similar within Project, but just not automate
the publishing, and leave that to the user.

Thanks!

Marc
 
M

Marc

Just an update in case anybody else runs into this or has issues.
I've done what I needed to do via VBA in MS Project, and it works like
a charm (now just having issues with other people importing it, but
that's a separate problem :). One thing that helped was if I got
stuck with trying to something specific in VBA, flip back over to
project and record a macro, then do in Project what I was trying to do
in code, stop the macro, and then edit it. That usually gives you a
good starting point.

Wheeeeee!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top