none
How do I read the enterprise custom fields in C#? RRS feed

  • Question

  • Hello,

    At the moment I am stuck trying to read out an enterprise custom field in an office Addin for Project.

    I know I can read out the custom fields for tasks like this and I am also able to get the project name.

    app = this.Application;
    
    //Custom field of a task
    wbs = app.ActiveCell.Task.Text1;
    
    //Project name 
    projectName = app.ActiveProject.Name;

    But I don't know how I can read an enterprise custom field. 
    I am trying to get the red marked field from the screenshot

    Thx for your help in advance 

    Monday, October 6, 2014 3:20 PM

Answers

  • Hi Pascal,

    Following code snippet should help you out:

       MSProject.PjField customField = app.FieldNameToFieldConstant("SAP Project Code");
       app.ActiveProject.ProjectSummaryTask.GetField(customField);

    Hope this helps

    • Marked as answer by Pascal90909 Monday, October 13, 2014 7:23 AM
    Monday, October 6, 2014 5:49 PM

All replies

  • Hi Pascal,

    Following code snippet should help you out:

       MSProject.PjField customField = app.FieldNameToFieldConstant("SAP Project Code");
       app.ActiveProject.ProjectSummaryTask.GetField(customField);

    Hope this helps

    • Marked as answer by Pascal90909 Monday, October 13, 2014 7:23 AM
    Monday, October 6, 2014 5:49 PM
  • Thank you very much. It works
    Monday, October 13, 2014 7:23 AM