Adding custom fields

  • Thread starter Fernando A. Gómez F.
  • Start date
F

Fernando A. Gómez F.

Hello all.

I have this application that will create a project in project server 2007.
While I've been able to create the project, I want to add custom fields to
the project. So, I think that by calling
ProjectDataSet.ProjectCustomFields.NewProjectCustomFieldsRow for creating a
row, and then AddProjectCustomFieldsRow it would be enough.

However, I'm not quite sure how to fill the row's data. I'm not sure what to
put in ProjectcustomFieldsRow.CUSTOM_FIELD_UID, CODE_VALUE, TEXT_VALUE,
MD_PROP_ID, etc.

Would anybody please guide me on what should I put in this properties? I've
been googling for hours and though I've found examples they do not explain
what those fields are for.

By the way, the project server is configured so that these fields actually
show (empty) even if I do not add the custom fields, so now I'm wondering
whether I should AddProjectCustomFieldsRow or simply modify them. If so, how
could I know which row belongs to which custom field?

Thanks in advance.

Regards,
FG.
 
R

Rod Gill

I can't help with PSI, but custom fields in Project Professional are not
added when you create a new project, they are there automatically. I suggest
therefore you explore modifying their values rather than adding them. Adding
a custom field suggests adding one to the entire Project Server instance.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 
F

Fernando A. Gómez F.

Rod Gill said:
I can't help with PSI, but custom fields in Project Professional are not
added when you create a new project, they are there automatically. I
suggest therefore you explore modifying their values rather than adding
them. Adding a custom field suggests adding one to the entire Project
Server instance.

Oh, I see. So, if I'm to set up the value of EF, I'd have to --say-- read
the project and simply modify the columns, right? I'll try that. Thanks!

Regards,
FG.
 
M

Martin Winzig

There is sample for TEXT_VALUE if you wand to modify different type you
should set BOOL_VALUE, NUM_VALUE, DATE_VALUE.




public ProjectWebSvc.ProjectDataSet SetProjectCustomFieldValue(Guid
ProjectGUID, ProjectWebSvc.ProjectDataSet prDataSet,
CustomFieldsWebSvc.CustomFieldDataSet.CustomFieldsRow field, String
string_value)
{

ProjectWebSvc.ProjectDataSet.ProjectCustomFieldsRow row =
FindProjectCustomField(ProjectGUID, prDataSet, field.MD_PROP_UID);
if (row == null)
{
Console.WriteLine("Field " + field.MD_PROP_NAME + " not
found");
row =
prDataSet.ProjectCustomFields.NewProjectCustomFieldsRow();
row.MD_PROP_UID = field.MD_PROP_UID;
row.CUSTOM_FIELD_UID = Guid.NewGuid();
row.TEXT_VALUE = string_value;
row.PROJ_UID = ProjectGUID;
row.MD_PROP_ID = field.MD_PROP_ID;
row.FIELD_TYPE_ENUM = field.MD_PROP_TYPE_ENUM;
prDataSet.ProjectCustomFields.AddProjectCustomFieldsRow(row);
}
else
{
row.TEXT_VALUE = string_value;
}

return prDataSet;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top