Recently I had to set the value of a Project Server Enterprise Custom Field from a .NET client application. The samples I found on the web (like this one) used the PSI , and I found them rather developer-unfriendly. For example, with PSI we should work with DataSet objects, check if the custom field already exists or should be first created, and should set various properties depending of the data type of the custom field.
So I’ve decided to create my own implementation based on the Managed Client Object Model. In my case I had to set a project-related custom field. In the first step I assumed, that the project ID and the internal name of the custom field are known. The internal name of the custom field consists of the prefix Custom_ and the GUID of the field without the separator dashes.
The result is the following code:
If the project ID and the internal name of the custom field are not known, it is easy to get them from the names like this:
Note, how much this solution is simpler than the PSI-alternative.