Project cannot be accessed in ProjectBeforeSave in Project Pro 2007

A

Adam Behrle

Hi Everyone,

Has anyone noticed the following behavior in Project Professional
2007, connected to Project Server 2007?

If an enterprise project has changes, and the user closes the file by
going to File > Close or clicking the document 'x', the save/disregard
checkin/checkout dialog is displayed. If the user selects save, the
save events are thrown but the Project seems to be in a strange
unloaded state. If you try to access the project via code, you get "An
unexpected error occurred in the method" exception. You get this even
if you go to the Projects collection.

My best guess is the project is temporarily put in an unloaded state
so it can be cached. However this breaks any code that attempts to
save data into the project before the save occurs.

One workaround is to perform the work in ProjectBeforeClose, anyone
found a cleaner way to do this?

Thanks,

Adam
 
S

Scudder

Hi Adam,

This is a bear that MS really ought to fix....

I built an event test model a while ago to benchtest all MS Project events
and discovered so many inconsistencies in the MS Project event model,
particularly in the ProjectBeforeSave / ProjectBeforeClose event behaviour
that I dispensed with it entirely and subclassed the object model with hooks
to reliably trap user responses.

I have some example projects that perform fine and report no errors but do
not trigger any MS Project events !!! Not even the NewProject, Activate or
Deactivate events.

I seriously don't recommend taking this path though unless you really need
industrial application strength, hooking events has very limited or no
debugging capability and requires some knowledge of the Windows messaging
architecture.

So I guess the bottom line is, no I don't have an easy solution to you
problem.

The upside though is, it is stable and allows you to extend trackable events
- such as having your own ProjectAfterClose event....one I really needed.
 

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