O
Ogawa
I'm trying to set a value of task custom field via PSI.
(I use Project Server 2007.)
I can update value of task custom field, but I can't
set value of not created task custom field.
I excerpt the following from my code.
WebSvcProject.Project project = new WebSvcProject.Project();
ProjectDataSet projectList =
project.ReadProjectEntities(prjID, 2,
WebSvcProject.DataStoreEnum.WorkingStore);
WebSvcProject.ProjectDataSet updateDataSet = new ProjectDataSet();
WebSvcProject.ProjectDataSet.TaskCustomFieldsRow customRow =
retDataSet.TaskCustomFields.NewTaskCustomFieldsRow();
customRow.CUSTOM_FIELD_UID = Guid.NewGuid();
customRow.PROJ_UID = prjID;
customRow.TASK_UID = taskID;
customRow.TEXT_VALUE = "initial value";
customRow.MD_PROP_UID =
PSLibrary.CustomField.LOCAL_CUSTOM_FIELD_MD_PROP_UID_TASK_TEXT1;
customRow.MD_PROP_ID = PSLibrary.TaskProperties.Text1.WinProjId;
customRow.FIELD_TYPE_ENUM = (byte)PSLibrary.CustomField.Type.TEXT;
updateDataSet.TaskCustomFields.AddTaskCustomFieldsRow(customRow);
project.CheckOutProject(prjID, sessionId, "");
project.QueueUpdateProject(Guid.NewGuid(), sessionId, updateDataSet,
false);
// project.QueueAddToProject(Guid.NewGuid(), sessionId, updateDataSet,
false);
project.QueueCheckInProject(Guid.NewGuid(), prjID, true, sessionId, "");
This code can only work well when TEXT1 field is created already and is
setted value.
In case TEXT1 field isn't created, "SoapException:
LastError=CustomFieldInvalidID" occurred.
Please help me.
Regards.
(I use Project Server 2007.)
I can update value of task custom field, but I can't
set value of not created task custom field.
I excerpt the following from my code.
WebSvcProject.Project project = new WebSvcProject.Project();
ProjectDataSet projectList =
project.ReadProjectEntities(prjID, 2,
WebSvcProject.DataStoreEnum.WorkingStore);
WebSvcProject.ProjectDataSet updateDataSet = new ProjectDataSet();
WebSvcProject.ProjectDataSet.TaskCustomFieldsRow customRow =
retDataSet.TaskCustomFields.NewTaskCustomFieldsRow();
customRow.CUSTOM_FIELD_UID = Guid.NewGuid();
customRow.PROJ_UID = prjID;
customRow.TASK_UID = taskID;
customRow.TEXT_VALUE = "initial value";
customRow.MD_PROP_UID =
PSLibrary.CustomField.LOCAL_CUSTOM_FIELD_MD_PROP_UID_TASK_TEXT1;
customRow.MD_PROP_ID = PSLibrary.TaskProperties.Text1.WinProjId;
customRow.FIELD_TYPE_ENUM = (byte)PSLibrary.CustomField.Type.TEXT;
updateDataSet.TaskCustomFields.AddTaskCustomFieldsRow(customRow);
project.CheckOutProject(prjID, sessionId, "");
project.QueueUpdateProject(Guid.NewGuid(), sessionId, updateDataSet,
false);
// project.QueueAddToProject(Guid.NewGuid(), sessionId, updateDataSet,
false);
project.QueueCheckInProject(Guid.NewGuid(), prjID, true, sessionId, "");
This code can only work well when TEXT1 field is created already and is
setted value.
In case TEXT1 field isn't created, "SoapException:
LastError=CustomFieldInvalidID" occurred.
Please help me.
Regards.