none
Cannot QueueCreateProject with ProjectCustomFields Linked to a LookUpTable RRS feed

  • Question

  • Hi All,

    I'm using EPM 2007 and trying to create projects via PSI Web Services.

    The system works well when only filling in the Project.

    I get the GeneralUnhandledException (42) when I try to add the custom field.

    Here is an extract of my code :

     

    ProjectWebSvc.ProjectDataSet.ProjectRow projectRow = projectDs.Project.NewProjectRow();
    //Set up of the project row
    Guid projId = Guid.NewGuid();
    projectRow.PROJ_UID = projId;
    projectRow.PROJ_NAME = Project.Name;
    projectRow.PROJ_PROP_TITLE = Project.Name;
    projectRow.PROJ_TYPE = (int)PSLibrary.Project.ProjectType.Project;
    
    // Where CfDataTable is the CustomFieldsRow found - that works (the code is too long to be inserted here)<br/>
    ProjectWebSvc.ProjectDataSet.ProjectCustomFieldsRow newCFrow = projectDs.ProjectCustomFields.NewProjectCustomFieldsRow();
    newCFrow.SetNUM_VALUENull();
    newCFrow.SetFLAG_VALUENull();
    newCFrow.SetDUR_VALUENull();
    newCFrow.SetDUR_FMTNull();
    newCFrow.SetDATE_VALUENull();
    newCFrow.SetCODE_VALUENull();
    newCFrow.SetTEXT_VALUENull();
    
    newCFrow.MD_PROP_UID = CfDataTable.MD_PROP_UID;
    //newCFrow.MD_PROP_ID = CfDataTable.MD_PROP_ID;
    newCFrow.CUSTOM_FIELD_UID = Guid.NewGuid();
    newCFrow.PROJ_UID = projGuid;
    newCFrow.FIELD_TYPE_ENUM = CfDataTable.MD_PROP_TYPE_ENUM;
    // Where lookupTableTreeUid is the LT_STRUCT_UID of the LookupTableTreesRow (the code is too long to be inserted here)<br/>
    newCFrow.CODE_VALUE = lookupTableTreeUid;
    
    projectDs.ProjectCustomFields.AddProjectCustomFieldsRow(pcfRow);
    

     

    In the project server log I get :

    PSI: Project.QueueCreateProject Undefined Attributes: PSError: GeneralUnhandledException Undefined attributes list: System.Data.StrongTypingException: The value for column 'MD_PROP_UID_SECONDARY' in table 'CustomFields' is DBNull. ---> System.InvalidCastException: Specified cast is not valid.
    at Microsoft.Office.Project.Server.Schema.CustomFieldDataSet.CustomFieldsRow.get_MD_PROP_UID_SECONDARY()
    --- End of inner exception stack trace --- at Microsoft.Office.Project.Server.Schema.CustomFieldDataSet.CustomFieldsRow.get_MD_PROP_UID_SECONDARY() at Microsoft.Office.Project.Server.BusinessLayer.CustomFields.FindMatchingRow(CustomFieldsDataTable table, Guid cfUID) at Microsoft.Office.Project.Server.BusinessLayer.CustomFields.Validate(DataTable customFieldsTable, String entityPrimaryKeyName, DataTable parentTable, Guid entityTypeUid, Guid projectUid, Boolean deleteCFValuesOnModify, Boolean fromWinProj) at Microsoft.Office.Project.Server.BusinessLayer.CustomFields.ValidateForProject(DataTable customFieldsTable, String entityPrimaryKeyName, DataTable parentTable, Guid entityTypeUid, Guid projectUid, Boolean fromWinProj) at Microsoft.Office.Project.Server.BusinessLayer.ProjectValidate.ValidateCustomFields(ProjectDataSet dataset, Guid projectUid) at Microsoft.Office.Project.Server.BusinessLayer.ProjectValidate.ValidateData(Guid projectUid, ProjectDataSet dataset, Boolean isNew) at Microsoft.Office.Project.Server.BusinessLayer.Project.IsValidData(Guid projectUid, ProjectDataSet dataset, Boolean isNew) at Microsoft.Office.Project.Server.BusinessLayer.Project.QueueCreateProject(Guid jobUid, ProjectDataSet dataset, Boolean validateOnly) at Microsoft.Office.Project.Server.WebService.Project.QueueCreateProject(Guid jobUid, ProjectDataSet dataset, Boolean validateOnly) Adding HQ\srv_msproject to local group 0

    There are no problem using this CustomField from MS Project.

    Thanks in advance for the help you can get me, I have been stuck for a while in this exception,

    Regards,

    Yann

    Thursday, October 21, 2010 4:32 PM

Answers

All replies

  • Anyone?

    Please...

    Wednesday, October 27, 2010 6:56 AM
  • what product version (CU, SP) please?
    Blog | Facebook | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
    Project Server TechCenter | Project Developer Center | Project Server Help | Project Product Page
    Wednesday, October 27, 2010 7:07 AM
  • Here are the server caracteristcs :

    System :

     Microsoft Windows Server 2003 R2

     Stand Edition

     Service Pack 2

    Computer:

     Six-Core AND Opteron

     Processor 8439 SE

     2.79 GHz, 2GB RAM

    EPM Version :

     Version:    12.0.0.6514

     

    Thanks in advance for your input,

     

    Regards,

     

    Yann

    Wednesday, October 27, 2010 10:38 AM
  • Please check the data population tool it contains code that does that, that you could leverage from http://blogs.msdn.com/b/chrisfie/archive/2008/04/21/tools-available-to-test-project-and-project-server-2007.aspx
    Blog | Facebook | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
    Project Server TechCenter | Project Developer Center | Project Server Help | Project Product Page
    Friday, October 29, 2010 3:20 AM
  • Hello Christophe,

    Thanks for the source code, I copied the AddProjCFs method into my project.

    I get the same Exception.

    Here are some new element :

    The custom field I'm trying to add into my project :

    <CustomFieldDataSet xmlns="http://schemas.microsoft.com/office/project/server/webservices/CustomFieldDataSet/">
     <CustomFields>
      <MD_PROP_UID>16c7e08c-3012-4725-94c4-819967d22221</MD_PROP_UID>
      <MD_PROP_ID>188776501</MD_PROP_ID>
      <MD_PROP_UID_SECONDARY>fba3121c-25e2-407d-a299-5aab2addebe7</MD_PROP_UID_SECONDARY>
      <MD_ENT_TYPE_UID>ebad93e7-2149-410d-9a39-a8680738329d</MD_ENT_TYPE_UID>
      <MD_PROP_NAME>Test_SIG Number</MD_PROP_NAME>
      <MD_LOOKUP_TABLE_UID>e6b525e4-11ce-478c-b80a-248021b82abb</MD_LOOKUP_TABLE_UID>
      <MD_PROP_TYPE_ENUM>21</MD_PROP_TYPE_ENUM>
      <MD_PROP_IS_LEAF_NODE_ONLY>false</MD_PROP_IS_LEAF_NODE_ONLY>
     </CustomFields>
    </CustomFieldDataSet>
    

    And the project itself :

    <ProjectDataSet xmlns="http://schemas.microsoft.com/office/project/server/webservices/ProjectDataSet/">
     <Project>
      <PROJ_UID>6664ca8c-1cb1-4f0a-8c62-5580101bbb9c</PROJ_UID>
      <PROJ_NAME>YGY_To_Delete_600</PROJ_NAME>
      <PROJ_TYPE>0</PROJ_TYPE>
      <PROJ_PROP_AUTHOR>HQ\dguex</PROJ_PROP_AUTHOR>
      <PROJ_PROP_MANAGER>HQ\dguex</PROJ_PROP_MANAGER>
      <PROJ_PROP_TITLE>YGY_To_Delete_600</PROJ_PROP_TITLE>
      <ProjectOwnerID>28758e32-4b22-48c5-ace8-030945a351d3</ProjectOwnerID>
     </Project>
     <ProjectCustomFields>
      <CUSTOM_FIELD_UID>9c548764-30e1-427e-aa62-168d50a2163d</CUSTOM_FIELD_UID>
      <PROJ_UID>6664ca8c-1cb1-4f0a-8c62-5580101bbb9c</PROJ_UID>
      <MD_PROP_UID>16c7e08c-3012-4725-94c4-819967d22221</MD_PROP_UID>
      <CODE_VALUE>b9600c46-5b38-45bf-994f-27a281cba2d5</CODE_VALUE>
     </ProjectCustomFields>
    </ProjectDataSet>
    

    Any more ideas? can  the structure of the custom fields be wrong or malformed?

    Thanks for your answers,

    Regards,

    Yann

    Monday, November 1, 2010 5:29 PM
  • Not sure, does it work when you do it manually using the product interface?
    Blog | Facebook | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
    Project Server TechCenter | Project Developer Center | Project Server Help | Project Product Page
    Monday, November 1, 2010 10:45 PM
  • Yes it does, if I create a project via EPM and then add a custom field via WebServices (QueueAddToProject or QueueUpdateProject) I get the same exception.

    The exception is raised while validating the custom field for the project -this is what I understand so far - but why does it not read the custom field correctly.

    I am lost there...

    Tuesday, November 2, 2010 7:26 AM
  • Sorry, the creation is made by EPM but by MsProject.

     

    Regards

    Tuesday, November 2, 2010 11:11 AM