locked
Get all available custom fields using PSI RRS feed

  • Question

  • I have created a few Enterprise custom fields in Project server 2010.  I am trying to create a Form to display all the available Enterprise custom fields.(for example 'Field Name', 'Entity' and 'data type'). I appreciate any help.

    Thank you.

    Thursday, April 21, 2011 3:40 PM

Answers

  • Hi Anate

    It can be done Using PSI OR By Pulling out the data from Project Server Reporting DB, whichever you are comfortable with

    For Getting it from reporting DB Use the query as below

    -- Change EntityType to Project, Resource, Task, Assignment, or Timesheet.
     
    SELECT CustomFieldName, ColumnPoolTableName, ColumnPoolColumnName
    FROM MFN_Epm_GetAllCustomFieldsInformation()
    WHERE EntityName = N'EntityType'

    For Getting it Using Custom Code , Consuming PSI Use the below mentioned code

    I used this code in 2007, and should work with 2010 as well

    private

    void button1_Click(object sender, EventArgse)
    {
    CustomFieldsWebSvc.
    CustomFields CfWebSvc = new RnDProject.CustomFieldsWebSvc.CustomFields();
    CustomFieldsWebSvc.
    CustomFieldDataSet CfDS = new RnDProject.CustomFieldsWebSvc.CustomFieldDataSet();
    CfWebSvc.Url =
    @http://ServerName/pwa/_vti_bin/psi/CustomFields.asmx;
    CfWebSvc.Credentials = System.Net.
    CredentialCache.DefaultCredentials;
    CfDS = CfWebSvc.ReadCustomFields(
    string.Empty, false);
    this.dataGridView1.DataSource = CfDS.Tables[0];
    }

    Apart with this, you might also want to have a look at LookupTable.asmx

    Hope this helps


    Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com
    • Proposed as answer by epmXperts Thursday, April 21, 2011 5:53 PM
    • Marked as answer by anate Thursday, April 21, 2011 7:32 PM
    Thursday, April 21, 2011 5:27 PM

All replies

  • Hi Anate

    It can be done Using PSI OR By Pulling out the data from Project Server Reporting DB, whichever you are comfortable with

    For Getting it from reporting DB Use the query as below

    -- Change EntityType to Project, Resource, Task, Assignment, or Timesheet.
     
    SELECT CustomFieldName, ColumnPoolTableName, ColumnPoolColumnName
    FROM MFN_Epm_GetAllCustomFieldsInformation()
    WHERE EntityName = N'EntityType'

    For Getting it Using Custom Code , Consuming PSI Use the below mentioned code

    I used this code in 2007, and should work with 2010 as well

    private

    void button1_Click(object sender, EventArgse)
    {
    CustomFieldsWebSvc.
    CustomFields CfWebSvc = new RnDProject.CustomFieldsWebSvc.CustomFields();
    CustomFieldsWebSvc.
    CustomFieldDataSet CfDS = new RnDProject.CustomFieldsWebSvc.CustomFieldDataSet();
    CfWebSvc.Url =
    @http://ServerName/pwa/_vti_bin/psi/CustomFields.asmx;
    CfWebSvc.Credentials = System.Net.
    CredentialCache.DefaultCredentials;
    CfDS = CfWebSvc.ReadCustomFields(
    string.Empty, false);
    this.dataGridView1.DataSource = CfDS.Tables[0];
    }

    Apart with this, you might also want to have a look at LookupTable.asmx

    Hope this helps


    Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com
    • Proposed as answer by epmXperts Thursday, April 21, 2011 5:53 PM
    • Marked as answer by anate Thursday, April 21, 2011 7:32 PM
    Thursday, April 21, 2011 5:27 PM
  • Thanks for the sample code. It's working.
    Thursday, April 21, 2011 6:05 PM