您好,我想实用地编辑 Project Server 2010 的自定义字段,但我不知道我在哪里做错了。以下是代码,
请在这方面帮助我
ProjectSoapClient projectSvc = new ProjectSoapClient();
CustomFieldsSoapClient customfieldSvc = new CustomFieldsSoapClient();
CustomFieldDataSet fieldDefs = customfieldSvc.ReadCustomFields(string.Empty, false);
Guid projectId = new Guid(projGuid);
ProjectDataSet projectDs = projectSvc.ReadProject(projectId, ListProjects.Project.DataStoreEnum.WorkingStore);
foreach (ProjectDataSet.ProjectCustomFieldsRow cfRow in projectDs.ProjectCustomFields.Rows)
{
CustomFieldDataSet.CustomFieldsRow fieldDefinition = fieldDefs.CustomFields.Single(
cfd => cfd.MD_PROP_UID == cfRow.MD_PROP_UID);
//if (cfRow.FIELD_TYPE_ENUM == 21 || cfRow.FIELD_TYPE_ENUM == 15) //if it is a choice field
//{
if (fieldDefinition.MD_PROP_NAME == "ProductCategory")
{
cfRow.TEXT_VALUE = newValue;
}
//}
}
Guid sessionUid = Guid.NewGuid();
Guid jobUid = Guid.NewGuid();
if (!IsProjectCheckedOut(projectId))
{
projectSvc.CheckOutProject(projectId, sessionUid, "Updating CF");
jobUid = Guid.NewGuid();
projectSvc.QueueUpdateProject(jobUid, sessionUid, projectDs, false);
}
jobUid = Guid.NewGuid();
projectSvc.QueuePublish(jobUid, projectId, true, SPContext.Current.Site.Url);
projectSvc.QueueCheckInProject(jobUid, projectId, true, sessionUid, "Updating CF");