How To Add Custom Field for A Task using PSI

P

Paul

I see several items pertaining to this, but for the life of me, I don't see
an actual example.

I am trying to put text into the Text1 field of a task. I am adding the
tasks to a project and trying to update the Text1 field in the same dataset,
and I hope that is ok.

Does anyone have an idea of why this wouldn't work?

ProjectWebSvc.ProjectDataSet.TaskCustomFieldsRow tCustomField =
projectDs.TaskCustomFields.NewTaskCustomFieldsRow();

tCustomField.CUSTOM_FIELD_UID = Guid.NewGuid();
tCustomField.PROJ_UID = projectGuid;
tCustomField.TASK_UID = activ.guid;
tCustomField.FIELD_TYPE_ENUM =
(byte)PSLibrary.PSDataType.STRING;
tCustomField.TEXT_VALUE = "A Little Comment";
tCustomField.MD_PROP_UID =
PSLibrary.CustomField.LOCAL_CUSTOM_FIELD_MD_PROP_UID_TASK_TEXT1;
tCustomField.MD_PROP_ID =
PSLibrary.TaskProperties.Text1.WinProjId;

projectDs.TaskCustomFields.AddTaskCustomFieldsRow(tCustomField);

I get an error from PSI when I call the QueueAddToProject method. The error
is: CustomFieldInvalidID

ok, so What does that mean? What is CustomFieldInvalidID? Is the task id
invalid, the proj id, the custom field id, the md prop uid, or the
md_prop_id? I wish the error message was more descriptive...

There is a lot of other code, but I didn't want to paste it to try to keep
from cluttering up the post. thanks so much for any help given.

Paul
 
S

Stephen Sanderlin [MVP]

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