This project is read-only.

Duration Attributes on Tasks? Start1 and Finish1

May 19, 2014 at 2:33 PM
Edited May 19, 2014 at 2:40 PM
I can map other values but the Start4 Data shown below does NOT work.

I found the GUID for Start4 in the database "21023F23-42D3-4978-A2B3-029064693577".

Does anyone know of a good example?

Thanks!
 [PSEntityType(PSEntityType.Task)]
  public class ProjectServerTask
  {
    [PSEntityUidField(ColumnName = TaskCustomFieldsColumnNames.TASK_UID)]
    public Guid TaskUid { get; set; }

    [PSNativeField(ColumnName = TaskCustomFieldsColumnNames.TASK_NAME)]
    public string Name { get; set; }

    [PSParentEntityUidField(ColumnName = TaskCustomFieldsColumnNames.PROJ_UID)]
    public Guid ProjectUid { get; set; }

    [PSCustomField(TaskCustomFieldGuids.Start4, FieldName = "Start4", FieldType = PSFieldType.Date)]
    public DateTime Start4 { get; set; }
May 19, 2014 at 3:25 PM
I don't think PSCustomField attribute is what you need - Start4 is rather native field, try using corresponding attribute
Andrew
May 19, 2014 at 4:26 PM
The following query will return the value I am looking for. Notice it is in the Task Custom Field Values table, so I thought it was a custom field. Although it is a "standard custom field" (oxymoron). Where as all the native fields I believe are in the MSP_TASKS Table.
SELECT DATE_VALUE
FROM MSP_TASK_CUSTOM_FIELD_VALUES
WHERE PROJ_UID = 'c1a65dc0-852e-4be3-9f90-31cdf85a25e8'
  AND TASK_UID = '41626C46-8B3C-418E-80BF-0E8FA0605BA8'
  AND CUSTOM_FIELD_UID = '21023F23-42D3-4978-A2B3-029064693577';
So what would the ColumnName be for this? TaskCustomFieldsColumnNames.????
May 20, 2014 at 3:50 PM
I found the appropriate GUIDs
 public class TaskCustomFieldGuidStrings
  {
    public const string Start1 = "{000039b7-8bbe-4ceb-82c4-fa8c0b400034}";
    public const string Start2 = "{000039b7-8bbe-4ceb-82c4-fa8c0b400037}";
    public const string Start3 = "{000039b7-8bbe-4ceb-82c4-fa8c0b40003a}";
    public const string Start4 = "{000039b7-8bbe-4ceb-82c4-fa8c0b40003d}";
    public const string Start5 = "{000039b7-8bbe-4ceb-82c4-fa8c0b400040}";
    public const string Start6 = "{000039b7-8bbe-4ceb-82c4-fa8c0b40011a}";
    public const string Start7 = "{000039b7-8bbe-4ceb-82c4-fa8c0b40011c}";
    public const string Start8 = "{000039b7-8bbe-4ceb-82c4-fa8c0b40011e}";
    public const string Start9 = "{000039b7-8bbe-4ceb-82c4-fa8c0b400120}";
    public const string Start10 = "{000039b7-8bbe-4ceb-82c4-fa8c0b400122}";

    public const string Finish1 = "{000039b7-8bbe-4ceb-82c4-fa8c0b400035}";
    public const string Finish2 = "{000039b7-8bbe-4ceb-82c4-fa8c0b400038}";
    public const string Finish3 = "{000039b7-8bbe-4ceb-82c4-fa8c0b40003b}";
    public const string Finish4 = "{000039b7-8bbe-4ceb-82c4-fa8c0b40003e}";
    public const string Finish5 = "{000039b7-8bbe-4ceb-82c4-fa8c0b400041}";
    public const string Finish6 = "{000039b7-8bbe-4ceb-82c4-fa8c0b40011b}";
    public const string Finish7 = "{000039b7-8bbe-4ceb-82c4-fa8c0b40011d}";
    public const string Finish8 = "{000039b7-8bbe-4ceb-82c4-fa8c0b40011f}";
    public const string Finish9 = "{000039b7-8bbe-4ceb-82c4-fa8c0b400121}";
    public const string Finish10 = "{000039b7-8bbe-4ceb-82c4-fa8c0b400123}";
  }
There are many more and the way to get them is to look in Microsoft.Office.Project.Server.Library "CustomField"
Console.WriteLine(CustomField.LOCAL_CUSTOM_FIELD_MD_PROP_UID_TASK_START1.ToString("B"))
So mapping the entity is done via....
    [PSCustomField(TaskCustomFieldGuidStrings.Start1)]
    public DateTime Start1 { get; set; }