We are using Project Server/Pro 2010 where we want to update custom field data on the fly: The user opens Project in Pro for read/write access and begins to make changes to the file and clicks save, the "on save" event fires, project is still checked out, Save Event fires, custom code runs and goes out to an SQL database fetches some data and updates the open file with a PSI call. Then the user can later and publish.
From my research (Jim) this would not be possible because the session GUID was generated on check out and would not be known by the custom program so it could not perform the update. Can someone please verify this and advise on how to best approach this. It might be better to have a Macro in the Enterprise Global to go out and fetch the data and perform update that way. What is recommended approach?
Answers from Internet.
1. My guess is that you’d be best off using VBA and a macro. Look online and
there’s a number of references on how to use VBA to write into custom fields.
Here’s Jack Dahlgren’s post on the topic: http://zo-d.com/blog/archives/microsoft-project/setting-microsoft-project-level-custom-fields-using-vba.html
Andrew Lavinsky [MVP] Blog: http://azlav.umtblog.com Twitter: @alavinsky
2. Hello Jim,
you could also use the ProjectSvc.ReadProject method to read the ProjectDataSet.ProjectRow.PROJ_SESSION_UID from the working store to get the session GUID.
With the session guid you´re able to update the project within the OnSave event.
I don´t know which is the best/recommended approach, technically you can go both ways.
3. I agree with Andrew. I have some good experiences with an add-in calling a webservice to retrieve information and setting the custom fields from within Project professional.
You can create an extention of the PSI to handle this cleanly.