Need to baseline a project programmatically Any idea on how to do this (2007 or 2010) RRS feed

  • Question

  • I have a client where we have created a project life cycle system using infopath that creates and updates Project custom fields at various stage through out the project life cycle.

    I have a requirement that when the project reaches a particular stage the baseline is set.

    If intersted in what peoples throughts are for this. Currently the system is 2007 but likely to be upgraded to 2010. If 2010 makes this easier then thats a bonus (business reason to upgrade).

    Some current ideas are to use the project interop via some c# code to open the project and set the baseline. the other idea is to use a macro that runs on open to see if a project custom field has been set (this would be set by some other code) and then set the baseline.

    I have a couple of issues with either approach. Automating project via .NET code is problimatic. Any warnings or users message are hard / impossiable to supress so there is anways a chance the routine will fail and you then need to kill the process.

    Using the macro solves the above issue as the user would have to deal with the warings as they appear. The issue i have with the macro approach is that the user needs permission to set the baseline. Once the baseline is set i need the user to not have permission. This could be solved with some MORE code that detects this and then adds the project to a new category with save baseline set to deny but this approach seems clunky.


    Any and all ideas welcome. Unfortunalty getting the user to do it is not an option.

    Just to be clear, the system is Project Server 2007 running on MOSS





    • Edited by Paul Busby Thursday, September 9, 2010 1:09 PM typo
    Thursday, September 9, 2010 1:07 PM

All replies

  • Hi Paul,

    If I understood correctly, the value of the custom field indicatig that a baseline value should be saved is set outside of Microsoft Project using PSI? That's ans assumption I'm gonna make for now...

    In the onOpen event, you check the value of the custom field and set a baseline if necessary. (as you already suggested)
    The macro changes the value of the custom field to something like 'baseline saved' (basically any value that will not trigger the macro again to save the baseline again, until the custom field is set again outside of Microsoft Project).

    To protect users from overwriting the baseline:

    • Using the TaskOnChange event, you prevent users from changing the custom field value (use a variable to tell the event to skip this test if it is your own macro who is updating the custom field)
    • Option 1: Disable the Set Baseline option in the menu (this can be done in Project 2007. I haven't tested it yet in Project 2010). If your users are allowed to save any of the other baselines, create your own 'save baseline Form' that only offers the baselines which they are allowed to save.
    • Option 2: Use the ProjectBeforeSaveBaseline event to prevent users from saving a baseline which they are not allowed to save.

    BTW: you can suppress most of the alerts by setting 'Application.DisplayAlerts' and 'Application.DisplayScheduleMessages' to False in your macro (make sure to set them back to True at the end of the macro!)

    I hope this helps,


    My EPM blog: Projectopolis
    Thursday, September 9, 2010 1:30 PM