Hi Godfrey,
Unfortunately I don't have samples to hand - but if you look at the ProjTool
sample that ships with the SDK, and particularly at the ProjCFDlg.cs file it
shows how the tool sets custom fields for Projects.
The steps you need are to add a ResourceCustomFieldsRow to your dataset
which can have the following properties:-
CUSTOM_FIELD_UID Specifies the unique ID for the custom field value.
MD_PROP_UID Specifies a unique ID for this custom field definition.
MD_PROP_ID Specifies an integer-formatted unique ID for this custom field
definition.
RES_UID Specifies the unique ID of the resource to which this custom field
belongs.
FIELD_TYPE_ENUM Specifies the PSDataType value for this custom field.
CODE_VALUE Specifies the value of the custom field if the FIELD_TYPE_ENUM
property is set to type GUID.
DATE_VALUE Specifies the value of the custom field if the FIELD_TYPE_ENUM
property is set to type DATE.
DUR_FMT Specifies the display format you want for the DUR_VALUE property if
the FIELD_TYPE_ENUM property is set to type DURATION.
DUR_VALUE Specifies the value of the custom field if the FIELD_TYPE_ENUM
property is set to type DURATION.
FLAG_VALUE Specifies the value of the custom field if the FIELD_TYPE_ENUM
property is set to type YESNO.
NUM_VALUE Specifies the value of the custom field if the FIELD_TYPE_ENUM
property is set to type NUMBER.
TEXT_VALUE Specifies the value of the custom field if the FIELD_TYPE_ENUM
property is set to type STRING.
So the MD_PROP_UID and ID are in fact lookups to the Guid for the custom
field you are settings, and this will also identify the FIELD_TYPE_ENUM
enumeration. Based on this enumeration which can be GUID, Date, Duration,
YESNO, Number or String the matchine _VALUE field will be set.
Once you have added this row and set the properties then the UpdateResource
method will set the code.