Project List Load duplicate key exception


EPMSync queries MOPS for a complete list of projects (loaded by type in order of Normal, Master, Activity Plans, and Inserted projects) and adds them to a dictionary object, using project name as the key. EPMSync kept throwing duplicate key exceptions on an Activity Plan during this load. At first I suspected an issue with name collision on an Inserted project with a Normal project but this was not the case. The client had no Master plans, Activity Plans, or Inserted projects. Upon analysis of the ReadProjectStatus call in the PSI I found that if the database held no data for a certain type and that type was requested in a ReadProjectStatus call, then the ProjectDataSet still returned a blank row. Since EPMSync processed the results in a foreach loop, it was adding a blank string to the dictionary object. The blank row from the Master projects load successfully added but the next type (Activity Plan) failed with the duplicate key exception. I verified this by adding an Activity Plan to the system and the duplicate key error began reporting for Inserted projects. I fixed this in EPMSync by only adding projects to the dictionary object if the project name had a length over zero. The EPMSync Configuration has a similar routine used to load the project list to define Excluded Projects (duplicate key exception happens here too) and I made the same change there. While I was in that code, I also enhanced the selection lists to allow for multiple project selection for exclusion/inclusion.
Paul Congdon
Milestone Consulting Group


vhelsink wrote May 24, 2009 at 5:23 AM

Can you please advise how to get the updated version you are mentioning here? We are facing the same exception.

wrote May 24, 2009 at 5:24 AM

wrote Feb 2, 2013 at 3:01 AM