I'm new to Project Server development and was wondering if you can use the PSI to set resource custom field values.
I can't seem to find any information for a beginner at this.
I currently have web references set up for the CustomFields and the Resource web service, but am unsure how to set a custom field for a particular resource.
Any help would be really appreciated!
Thanks!
I know your problem. Microsoft has really bad examples on MSDN. Lot of stuff doesn't work or has just been copied from the 2007 manual. I've started yesterday to develop with the Webservice for Project Server 2010.
Here is a simple (maybe not the best) solution for setting custom fields:
Complete source code: http://pastebin.com/tr7CGJsW
Prepare your solution
First I've added a Service Reference to:
After that, I've edited the app.config because I had to use special credentials to login into the project server (maybe this is not necessarily for you):
The commented code has been created by Visual Studio
Connect and Update
Now we can create a new SoapClient which communicates with the Project Server:
Now I have declared two Guids, that we know, what we want to update. The other variables are used later and are comment in the code:
Then we are ready to load the ProjectDataSet from the server, find the CustomField and updating the data. It's really simple:
If we changed a value, we have to send the ProjectDataSet to the ProjectServer now. It will update the changed values in the ProjectDataSet. For this, we have to check out our project, update it and check in again:
But now we just have updated the database. The server will still show us the "old" value and not the new one. This is because we didn't have published our project yet:
Finally we're done and our project is updated!
Enhancements
I'm very new to this platform (Project Server 2010), so this code maybe is not the best example. So there are some enhancements, which would made the solution better: