Hi,
Hi,
{
// Add new text extended attribute and one text value
taskTypeTextAttr = new ExtendedAttributeDefinition();
taskTypeTextAttr.Alias = "TaskType";
taskTypeTextAttr.FieldName = "Text27";
taskTypeTextAttr.ElementType = ElementType.Task;
taskTypeTextAttr.CfType = CustomFieldType.Text;
taskTypeTextAttr.FieldId = Convert.ToInt32(ExtendedAttributeTask.Text27).ToString();
taskTypeTextAttr.LookupUid = PhaseId;
project.ExtendedAttributes.Add(taskTypeTextAttr);
val1.Id = 1;
val1.Description = "Project Phase";
val1.Val = "Phase";
taskTypeTextAttr.ValueList.Add(val1);
val2.Id = 2;
val2.Description = "Process Step to Check quality";
val2.Val = "Process Step";
taskTypeTextAttr.ValueList.Add(val2);
Value val3 = new Value();
val3.Id = 3;
val3.Description = "Sales to delivery handoff";
val3.Val = "S2D";
taskTypeTextAttr.ValueList.Add(val3);
}
var phaseData = taskTypeTextAttr.CreateExtendedAttribute();
phaseData.Value = phaseData.AttributeDefinition.ValueList[0].Val;
projectPhase.ExtendedAttributes.Add(phaseData);
Hi Ujwal,
Project project = new Project();<o:p></o:p>
OutlineCodeDefinition textOutline = new OutlineCodeDefinition();
project.OutlineCodes.Add(textOutline);
// add a mask for text field
OutlineMask mask = new OutlineMask();
mask.Type = MaskType.Characters;
textOutline.Masks.Add(mask);
OutlineValue textValue = new OutlineValue();
textValue.Value = "Text value 1";
textValue.ValueId = 1;
textValue.Type = OutlineValueType.Text;
textValue.Description = "Text value descr 1";
textValue.FieldGuid = Guid.NewGuid().ToString().ToUpper();
textOutline.Values.Add(textValue);
OutlineValue textValue2 = new OutlineValue();
textValue2.Value = "Text value 2";
textValue2.ValueId = 2;
textValue2.Type = OutlineValueType.Text;
textValue2.Description = "Text value descr 2";
textValue2.FieldGuid = Guid.NewGuid().ToString().ToUpper();
textOutline.Values.Add(textValue2);
// Add new text27 extended attribute
ExtendedAttributeDefinition taskTextAttr = new ExtendedAttributeDefinition();
taskTextAttr.Alias = "New text27 attribute";
taskTextAttr.FieldId = ExtendedAttributeTask.Text27.ToString("D");
// add a reference to lookup table
taskTextAttr.LookupUid = textOutline.Guid;
taskTextAttr.CfType = CustomFieldType.Text;
project.ExtendedAttributes.Add(taskTextAttr);
// Add new task and assign attribute value
Task task = project.RootTask.Children.Add("New task");
task.Set(Tsk.Start, new DateTime(2016, 7, 4, 8, 0, 0));
task.Set(Tsk.Duration, project.GetDuration(8, TimeUnitType.Hour));
ExtendedAttribute taskAttrText = taskTextAttr.CreateExtendedAttribute();
// add a reference to lookup table value
taskAttrText.ValueGuid = textValue.FieldGuid;
task.ExtendedAttributes.Add(taskAttrText);
//project.Save(path + "SavedProject.mpp", SaveFileFormat.MPP);
project.Save(path + "SavedProject.xml", SaveFileFormat.XML);
if (customTaskTypeAttr != null)
{
var valueGuid = customTaskTypeAttr.ValueGuid;
if (!string.IsNullOrWhiteSpace(valueGuid))
{
// My Code never enters here as the valueGuid is always null
}
Hi Ujwal,
Hi Ujwal,
Hi Ujwal,
The issues you have found earlier (filed as TASKSNET-1593) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.