Project publishing event - feedback to user

R

Rickard

Using Project Server 2007 SP1 + (July) Infrastructure Update. We're using a
project publishing event handler which validates if a project should be
published to the server or not. If the validation returns "false", the
only feedback the user gets is a small "Job has been cancelled" label in
Project Professional 2007 (easy to miss). In this case we would like show a
"messagebox" that explains why the project didn't get published. We also want
a similar solution when users are trying to publish projects in the PWA (in
Edit Project Properties). Any ideas on how to solve this?
 
S

Stephen Sanderlin

There's really no facility that allows for this kind of two-way
communication with the user.



Here's what I would do instead:

1) Using the Trace Log Example code
(http://msdn.microsoft.com/en-us/library/aa979522.aspx and
http://msdn.microsoft.com/en-us/library/aa979595.aspx), have the custom
event handler write a detailed error to the ULS Log for at least the
Monitorable severity.

2) Write an error to the Application Event log.

3) Using System.Net.Mail, send an email to the user notifying them
of the error. Use the UserGuid property from the event handler's
PSContextInfo object to query the Resource web service to get the user's
email.

4) Cancel the operation.



There's a variety of ways to implement this functionality. If it were
me, I would implement an exception handling architecture by placing all
my code into try.catch.finally blocks. Remember to dispose of any
datasets and web reference instantiations in the finally block.



The benefit to using exceptions is that if you rethrow the exception
(remember to use throw, not throw ex, to preserve the stack trace) after
you perform your custom error processing the Event Handler architecture
will automatically cancel the event that raised the exception, so you
don't need to cancel it yourself. Note that when using this method, you
may not want to write a trace to the ULS and Application Event logs,
since the Event Handler architecture will do this itself.



Hope that helps!


--

Stephen Sanderlin

Principal Consultant

MSProjectExperts



For Project Server Consulting: http://www.msprojectexperts.com

For Project Server Training: http://www.projectservertraining.com



Read my blog at: http://www.projectserverhelp.com/

Join the community at: http://forums.epmfaq.com
 

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