To Add or Update – That is the Question. The PSI and custom fields – Updated

This posting was inspired by a support call concerning custom fields - but does apply to other entities in the Project dataset and others.  The question was around the QueueUpdateProject and QueueAddToProject web services calls that are part of the Project web service in the PSI.  If you use the wrong call then the error message is usually helpful telling you you can't add with the update call and vice versa.  But the thing that does catch people out are the custom fields... 

By default a project dataset will not contain any rows in the ProjectCustomFields data table unless they have either been set (through PWA, Project Professional or the PSI) or they contain formulae, or are based on a lookup table with a default value defined.  So for a freshly created project (from Project Professional) when looking at Project Information it appears that all custom fields are there - and some may even look to have values (number fields will show 0) whereas in fact once saved there are no rows in the dataset for project custom fields (except as mentioned above - formulae based, and default lookup tables values).  So if you want to set a custom field via the PSI your code should check if there is a row already present for that custom field (identify by the MD_PROP_UID or MD_PROP_ID) and if it is there then you can change the value and use QueueUpdateProject - and if it doesn't exist then you will need to create a new blank project dataset and add a new project custom field row and set the values (including a new GUID for CUSTOM_FIELD_UID, the projects PROJ_UID and the MD_PROP_UID for the field you want to set) then use the QueueAddToProject.

(Update - Although this logic holds true for adding/updating tasks to a Project dataset you can in fact ADD a new custom field row to an existing project dataset and use the QueueUpdateProject method - and it will work.  You do not need to use the QueueAddToProject method - although this will work too, assuming it only contains the additional custom field row!  Thanks to Martin for pointing this out - through experience.)

Just to confuse the situation we have a bug currently when using the PSI or creating an Activity Plan/Proposal that can duplicate custom field rows.  If you have any project level custom fields that use graphical indicators but do not have formulae then you can get duplicate custom field rows created for each of them.  I'm not sure yet if the bug is they get created at all (as they do not get created in Project Professional projects) or that they appear twice. I will post an update when I have more information.  For now a quick workaround is to not use graphical indicators for this type of field.  Cleaning up existing ones may be a little more challenging and I would suggest a support call.  Although this causes problems for the PSI when updating these duplicated rows (so this affects changes for Activity Plans , Proposals and use of the Edit Project Properties in PWA) you can still make changes in Project Professional through the Project Information dialog.

The errors you might see - (these are generic so you could see these errors for other root causes):-

When updating a custom field for an Activity Plan or Proposal you will get an error dialog box:-

Windows Internet Explorer
An error has occurred when saving your project to the server. Please contact your system administrator for assistance.

When updating a custom field through Project Center's Edit Project Properties option the error will display at the top of the page in red:-

The project could not be saved due to the following reason(s):

An unknown error has occured (occurred is mis-spelled in the error).

When updating through the PSI this will result in a GeneralUnhandledException.

One final point - setting or updating a project custom field for an existing Project Professional created project through the PSI or Edit Project Properties will also introduce this problem.  The extra duplicates will get added as well as the custom field you are setting.

Comments (49)

  1. This is probably my incident :), its nice to see that mictosoft working on my issues.

    If not you should contact Valdemar Spinola SRZ070420000436

  2. Thanks for the feedback Martin – and yes, I am working with Valdemar on this issue.

    Best regards,


  3. one of the question related to Custom fields was how to remove row from custom fields dataset, when I use the Multiselect list each selected item is represented by one row. And i need to now haw to remove row when user uncheck item.

  4. I’ve passed this information back to Valdemar – but in case this can get to you quicker, and for general readers – the answer is to use the Delete() method on the ProjectCustomFeilds row you wish to remove, then use the QueueUpdateProject method to commit the update.  So the code would look something like:-

    Check out project and read dataset

    Some code to identify the row you want to remove (the "i"th row in the example given below)


    Use QueueUpdateProject on the dataset then check in.

  5. This way i can remove row on the client but not on the server.

    PS I didn’t try to remove row from multiselect list box.

  6. Buy the way Project 2007 SDK should be updated, there should be note that in case that you need to ADD , REMOVE  or UPDATE custom property. You should modify the ProjectFustomFields dataset on the client and then use  QueueUpdateProject.

  7. The PSI ONLY acts on the server, but I’m not sure I follow what you mean by "client".  The Project Professional client should see any changes once you have completed the QueueUpdateProject and checked in – the next time you open the project.  I have tested this method both with multi value fields and also single value fields.

    Are you meaning you wish to remove a row from the server list of custom fields?  In this case you need to use the CustomFields or LookupTable web services – but the logic should be the same.

  8. Thanks for the feedback Martin.  You can also add content to the MSDN version of the SDK by clicking the Add new Community Content option on any page.  We do try to make the articles as accurate and complete as possible – but I am sure we will continue adding new examples as we find these gaps.

  9. Sharat Sanketi says:


    I had a query. How do I delete all project custom fields that I have defined using PSI leaving one column? Request your help

    I am trying to use the method below but even after check-in, it is showing me the values.


    foreach (DataRow drCustomField in projectDs.ProjectCustomFields.Rows)


                                        WebSvcProject.ProjectDataSet.ProjectCustomFieldsRow trCustomFieldToDelete = (WebSvcProject.ProjectDataSet.ProjectCustomFieldsRow)drCustomField;

                                        Guid YtdGuid = new Guid();

    YtdGuid = (Guid) drProjectCustomFieldRow[0][“CUSTOM_FIELD_UID”];

    if (trCustomFieldToDelete.CUSTOM_FIELD_UID != YtdGuid )


    //Call Queue Delete from Project Method

                                           project.QueueDeleteFromProject(jobId, sessionId, trCustomFieldToDelete.PROJ_UID, new Guid[] { trCustomFieldToDelete.CUSTOM_FIELD_UID });




    jobId = Guid.NewGuid();

    //Call Update Project Method

                                   project.QueueUpdateProject(jobId, sessionId, projectDs, false);



    catch (Exception ex)






                                   project.QueueCheckInProject(jobId, projectId, true, sessionId, SESSION_DESCRIPTION);

    jobId = Guid.NewGuid();


  10. Hi Sharat,

    To remove the custom field you need to use the Delete() method on the row in the dataset, and then use  QueueUpdateProject to persist this deletion back to the database.


  11. Gerardo Abal says:

    I’m having some problem during executing QueueAddToProject with the project changes.

    The only change is add a new assignement for an existing Task and an existing Resource.

    I catch always the same exception ProjectSchedulingEngineException; in this link says that if you change the property TASK_OUTLINE_LEVEL of a task the project server could throw an ProjectSchedulingEngineException.

    Of course I check the task and the property TASK_OUTLINE_LEVEL was the same, and this task is never been updated.

    I need some help, please email me: thanks

  12. Shreenivas says:

    Hi Brian,

    I have few questions regarding Enterprise Custom Fields

    1. I have lot of custom fields of “project entity” type defined, is there any option to import these custom fields every time I create a project. Note that these custom fields are just text,numerical fields without any formulas.

    2. I have created few “project entity” custom fields which use formulas and show the data. Now my question is “Is there a way to check whether my formula is working?” This is possible for “task entity” custom fields but not “project entity” custom fields. In project professional you can create a temporary task level field, check whether it is working and then can copy the same to enterprise level “task entity” custom field, but for “project type” custom field there is no such facility…Please help

    Thanks in advance,


  13. Hi Shreenivas,

    I am not sure I follow the first question. Do you want to set the fields for each project?  You could use the OnCreate event for projects and do this via code.  Or do you mean that you want to see the fields in the dataset of newly created projects?

    For the second question perhaps you could use the Project Summary task (Task 0) to test your formulae.  The project and task entities are very similar.

    Best regards,


  14. Shreenivas says:

    Thanks for the reply. It helped a lot.

  15. CYuvaraj says:

    Hi Brian

    I am trying to update a Custom Field [which was already added thru PWA] in a project through QueueUpdateProject.

    Steps I Did –

     – Got the project dataset from the working store

     – Updated the custom field value in ProjectCustomFields table.

     – Update the project QueueUpdateProject. Wait for completion

     – Check In the project and wait for completion

     – Publish the project.

    But everything goes through well but the data is not getting updated in PWA.

    If I give DataSet.AcceptChanges() before calling QueueUpdateProject, I get an error – CustomFieldRequiredValueNotProvided [Captured thru PSClientERR]

    Please advice what could be wrong



  16. Moritz Farbstein says:

    Not sure if this could be a related issue: I have a Master Project with two SubProjects. I have an enterprise Custom Field (resource) with a Lookup Table, called “Cost Type”. I created a View containing this field and Grouped on it. It worked fine for the first subproject. I made some resource edits in the second subproject and tried to use the same view on it and on the master project, but at this point all the custom field data was gone. Each individual project still shows all the right data in this custom field, but now when I open the View the grouping is gone and there is apparently no data coming through on the custom field into the view.

  17. HiYuvaraj,

    These appear to be the right steps.  If you do it through PWA does it work?  Or if you re-read the dataset from the working store is the modified data there?

    Best regards,


  18. CYuvaraj says:

    Hi Brian

    Thanks for the reply

    I am able to do it with PWA.

    For now, i created a new PWA and there it is working fine.. not sure what was the issue though…



  19. CYuvaraj says:

    Hi Moritz

    I had done some debugging on the custom fields with views. What happens is each time you update the custom fields, the in built views[like MSP_PROJECT_USERVIEW] which uses the custom fields get’s re created with the updated data[the existing field information also might change], So if you are using your custom views the new data may not updated automatically. This could be the problem

    Brian, Correct me if I am wrong 🙂



  20. CYuvaraj says:

    Hi Brian

    Sorry for flooding your blog three times in a day 🙂

    I have another issue now, I have added a custom event handler to the Project Check In event, but everytime when the event is raised i get the following error in the eventlog

    Event Type: Error

    Event Source: Office SharePoint Server

    Event Category: Project Server Server-Side Events

    Event ID: 7696

    Date: 8/31/2007

    Time: 11:46:24 AM

    User: N/A

    Computer: 51787


    Standard Information:PSI Entry Point:

    Project User: DomainName/Yuvaraj_C

    Correlation Id: ab718b41-3660-4e5f-8972-3f5e8a0818a8

    PWA Site URL: http://51787:32311/PWA

    SSP Name: SharedServices1

    PSError: GeneralActionCanceledBecauseServerEventServiceProblem (22002)

    Action cancelled because of a problem with the Project Server Event Service.

    Event that was cancelled: ProjectCheckIn.

    the event handler also is not executed

    Went through this article ,, but the solution to this is not given there

    Got the log file with me, but could not attach it here…

    Please advise what could be wrong

    Thanks a Lot


  21. Thanks for responding Yuvaraj – I think you are on the right tracks – not sure if a re-publish will flush everything through to the new view.


  22. Moritz Farbstein says:

    Re-publishing the projects did not flush everything through to the new view. Then I tried deleting the projects completely (although I did not delete the custom field) and re-saved/re-published the projects from saved copies; this did not work either. Next I might try deleting the projects, deleting the custom field, and recreating everything. The question now becomes, is there a “correct” order that things must occur in, for this mechanism to work?

  23. CYuvaraj says:

    Hi brian

    I am trying to read the project dataset in the custom event handler after project check in event.

    But i get the following error –


    Event Handler CustomHandler.FieldUpdateHandler threw an exception: The request failed with HTTP status 401: Unauthorized.

      at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)

      at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

      at CustomHandler.ProjectWebSvc.Project.ReadProject(Guid projectUid, DataStoreEnum dataStore)

      at CustomHandler.FieldUpdateHandler.OnCheckIn(PSContextInfo contextInfo, ProjectPostEventArgs e)

    For more information, see Help and Support Center at

    Clearly it shows it is due to the credentials issue. But i checked the ContextInfo.Username it is the same as my domain name and i have full privileages. by default IsWindowsUser was set to false, so I tried changing it to true before calling the web service, but still the same issue

    The same code when i run via a web service passes through fine.

    Please advice what could be the issue.



  24. Hi Yuvaraj,

    The event handler will be running in the context of the account running the event service – which will be the account set as the administrator of the SSP.  You can see who this account is by looking at task manager.  You should see more than one task for the Event service and one will be running as the farm administrator and each other one will be running as an administrator of any SSP’s defined that have PWA sites provisioned.  Of course they could all be the same user if you have it configured that way.  So one way to work is to add a user to PWA that is this user so that it can use the web services.  Another way is to use impersonation.  Either way you need valid credentials and url set for any web service you use.

    Best regards,


  25. CYuvaraj says:

    Hi Brian

    Thanks for the help, impersonation did the trick

    Thanks a lot



  26. CYuvaraj says:

    Hi Brian

    I have mapped the event handler to After check In event. In the event handler , i have to populate some custom fields based on the status of the project. For that I have checkout the project, update it  and  check in again, which triggers the check in event again. I tried OnUpdating event, but the ProjectDataset though updated does not reflect in the server. the logic is such a way that i cannot use a formula.

    Please advice how we can do this.

  27. Hi Yuvaraj,

    Tricky one.  The best I can think initially is to use the PROJ_SESSION_DESCRIPTION and read this before you check the file out for your event updates.  In your code you can set this to a specific string – whereas for user edits it will have machinenamepwa_profile. If you read your string then you know you have already made the required updates and can ignore the event. One other way would be to use the PROJ_CHECKOUTDATE.  If the check-in is a result of your code then the time will be very close to the current time.  If it was checked out by a user then they will very likely have had it open for some longer period of time.  This may allow you to break the loop. The first is probably the more reliable solution.


  28. CYuvaraj says:

    Hi Brian

    Thanks for the info, did not know such a provision exits. Will try it out



  29. Duffman says:

    Hi Brian,

    I would like to use TaskCustomFieldsRow to update some CF in a Project. I do not know how to do this. I have retrieved a taskRow that I want to target, but can’t get to the CF fields.

    ProjectWebSvc.ProjectDataSet.TaskRow taskRow;

    taskRow = projectDs.Task.FindByTASK_UIDPROJ_UID(….

    I can update non custom fields fine and save and publish…. just can’t get to the CF.



  30. gsk says:

    Hi Brian,

    I have custom field called Expense at Task level and trying to update the value programatically. I am getting an error “CustomFieldRequiredValueNotProvided” and I checked all the other required CF and it has values. Could you please let me know how to update the value for that CF?

    Thanks in advance, GSK

  31. Sarfaraz says:

    Hello Yuvraj,

           Can u please send me the code of how you managed to update the custom field values of a given project.

    I am all confused looking at various materials on the net.

    Thanks a million.

  32. gecheverry says:

    hi guys

    i’ve been trying to create/update a custom field with no luck, here is the code, would you please point me on the error, regards

    ProjectDataSet.ProjectCustomFieldsRow row = projectDs.ProjectCustomFields.NewProjectCustomFieldsRow();

    row.MD_PROP_UID = CustomField.CustomFieldGUID;

    row.CODE_VALUE = LookupTable.GetLookupId(value);

    row.CUSTOM_FIELD_UID = Guid.NewGuid();

    row.PROJ_UID = ProjectID;


    i must add everything has been validated and contains the correct values, but when issuing queueUpdateProject the changes don’t show up in the project information dialog (Project Professional 2007)

    thanks in advance

  33. Hi Gecheverry and Sarfarz,

    If I can’t find a sample I will do a posting shortly on this topic.

    Best regards,


  34. Hi Brian,

    I’m having a problem when using QueueAddtoProject to add tasks and assignments to a blank project.

    Here’s the text of the Queue Error I get:

    Message:’MSP : Queue request Failed for Job ID 3cbbad1d-263e-4fbc-b74e-bb4f06dff0e6.

    <?xml version="1.0" encoding="utf-16"?>



       <class name="Project">

         <error id="9133" name="ProjectSchedulingEngineException" uid="50ba33e1-6500-49c1-8aad-ecfd43c5e969" exception="Microsoft.Office.Project.Scheduling.SchedulingException: Cannot extend beyond minimum date&#xD;&#xA;   at Microsoft.Office.Project.Server.BusinessLayer.ProjectSchedule.Schedule()&#xD;&#xA;   at Microsoft.Office.Project.Server.BusinessLayer.ProjectMain.HandleProject(ProjectDataSet dataset, Guid projectUid, Guid userUid, String userName, Boolean isNew, Boolean addColumns, ProjectLocks projectLock, Boolean fCheckReadOnly, Boolean fCheckProtectedActuals, Boolean fAllowAddEntRes, Boolean fOptIndexRecalced)" />


       <class name="Queue">

         <error id="26000" name="GeneralQueueJobFailed" uid="0044e41a-9645-4d6f-a80c-5becd2ecded4" JobUID="3cbbad1d-263e-4fbc-b74e-bb4f06dff0e6" ComputerName="AU

    I do NOT set any of the Task Start Dates, and I have no constraints on them to dictate the schedule. I have set the Project Start Date though, so I expect the Task Start Dates to default to this date.

    Everything happens fine for most cases of Projects I create, but the above error occurs when I have some assigments on Labour Resources whose ASSN_WORK is very huge, extending over couple of DECADES of work.

    It is absolutely essential that I fix this soon. Huge assignment work data is very much possible in the business I want to integrate Project with.

    Thanks and Regards,


  35. PS: I have the Service Pack 1, the August CU and the Infrastructure update installed.

  36. Hi Subramanian,

    To help isolate the issue I would suggest seeing which value is causing the problem – or which is the smallest value causing the problem.  Also see the Specification topic in the help for details of limits in Project.  Are any of your assignments going out beyond the latest date allowed for calulation in project – December 31, 2049?  

    Best regards,


  37. kenfhenderson says:

    Hi Brian,

    I have lots of PS2007 projects that have been migrated from PS2003. When I fetch the project dataset so I can update and/or add custom field values, it usually works fine. However, sometimes the PSI call complains about some of the other tables in the project dataset. I get the following types of errors when I do the queuepublish.




    My code has not touched those tables in the dataset.  How do I get around this problem?

    Thanks much!

    Ken Henderson

  38. Hi Ken,

    I have seen very similar errors arise when creating projects via the PSI from migrated projects.  I thought we had those issues resolved. What CU do you have loaded?

    Best regards,


  39. Jono says:

    Regarding refreshing Custom Fields using the PSI.

    We have a situation where a Project manager creates a new Calculated Project Custom Field and adds it to a View. All projects that have not been republish via Project pro have empty values in the new custom field. However when you republish with Project Pro the calulation is fired and the custom field contains a value…..Very Simple.

    The problem is when you want to refresh projects is Project center using the PSI. QueuePublish or QueueUpdateProject does not refresh / Recalulate custom fields.

    The reason why it does not refresh against a project is because the assocoation between the Project and the master custom field has not been made. Project Pro automaticaly creates a new association when you publish a project.

    So… You need to check which custom fields have been associated to a project and then Add missing custom fields using QueueAddToProject…

    If anyone knows of another way PLEASE let me know…..Hope this helps…

  40. António Madeira says:

    Regarding refreshing Calculated Task Custom Fields using the PSI:

    I have been having trouble with calculated task  custom fields, using the PSI.

    When I republish (full publish) a project through the PSI and then check Project Center(PWA), the calculated fields are not updated.

    I’ve also tried to force the value into the calculated field but trying to Save the Project gets me a SoapException with the error "CustomFieldCannotSetValueOnFormulaFields".

    Does anyone know how can I mimic the behavior

    of Project Pro?

    Thanks in Advance.

  41. Rayees says:

    hello guys .

    i am able to add, update project, task and assignment custom field rows with or without lookups successfully after having to go through as much documentation as possible.

    But i am badly stuck when i try to update   assignment customfield on which lookup is applied. It allows me to write the code value here

    custRow.CODE_VALUE = codevalue;

    but at Queueupdate()

    it throws the unhandled exception.

    System.Web.Services.Protocols.SoapException: ProjectServerError(s) LastError=GeneralUnhandledException Instructions: Pass this into PSClientError constructor to access all error information

      at Microsoft.Office.Project.Server.WebService.Project.QueueUpdateProject(Guid jobUid, Guid sessionUid, ProjectDataSet dataset, Boolean validateOnly)

    Please help .

    thanks in advance


  42. Hi Rayees,

    I posted back on the 2010 forum and gave a couple of suggestions.  I don’t have an answer for you, but see how those tips work (adding new CF that doesn’t exist, and trying the statusing web part.)

    Best regards,


  43. Gary McNeeley says:

    Hi Brian,

    We migrated projects from 2003 to 2007 and are using PSI calls for updating projects, publishing, etc.  Numerous projects are causing PSI errors to be thrown, one such error is AssignmentCannotEditSummaryTask, although we are just updating custom field values.  There are 4 assignments in a summary task for this project, we can modify the project in ProjectPro, publish, etc, but not through PSI.  One other error we are receiving is a "CustomFieldInvalidTypeColumnFilledIn" error (different project), but cannot replicate it on our development or training environment.  Any suggestions?  Any help would be greatly appreciated.

  44. Hi Brian

    I have a new way to generate this error !!!!

    If you move a project into a catagory with "Manage security" rights but not "Manage Check-Ins"… You to can be blessed with a typo error from above… <Project Server 2007+SP2+FebCU10>

  45. Thanks for sharing Richard.  I’ll see if we know about that one…

  46. Shravan Dubey says:

    Dear Brian,

    Here the same problem persists, but I am not getting what I am missing in my code.

    I am updating Project Custom Field (P_CF) value for selected projects from drop down list.

    If P_CF is not having lookup and data type as Text, I am able to update it.

    But, If P_CF is having lookup and data type as Text, I am getting exception in QueueUpdateProject method as:

    ProjectServerError(s) LastError=CustomFieldInvalidTypeColumnFilledIn Instructions: Pass this into PSClientError constructor to access all error information.

    Example: CF=Department and Lookup Table associated with CF (Department) is LT_Department containing values as




    What I want to do: For a project, selected Department value= Dept1.

    I want to update it by some other existing value (say Dept2).

    Here is my code:

    PSLibrary.Filter cfFilter = new PSLibrary.Filter();

    cfFilter.FilterTableName = lt_DS.LookupTables.TableName;

    ds.Add(new PSLibrary.Filter.Field(lt_DS.LookupTableTrees.TableName,


    cfFilter.Fields.Add(new PSLibrary.Filter.Field(lt_DS.LookupTableTrees.TableName,l

    t_DS.LookupTableTrees.LT_VALUE_DESCColumn.ColumnName,               Microsoft.Office.Project.Server.Library.Filter.SortOrderTypeEnum.Asc));

               PSLibrary.Filter.FieldOperator criteria =

           new Microsoft.Office.Project.Server.Library.Filter.FieldOperator

           (PSLibrary.Filter.FieldOperationType.Equal, "LT_NAME",

           new string[] { "LT_Department" });

               cfFilter.Criteria = criteria;

               // The GetXml method creates the xmlFilter parameter for ReadCustomFields

               lt_DS = webSvcLT.ReadLookupTables(cfFilter.GetXml().ToString(), false, 0);

               DataTable dtLTValue = null;

               dtLTValue = lt_DS.Tables[0];

               ddlSelectedLookupValue.DataTextField = "LT_VALUE_TEXT";

               ddlSelectedLookupValue.DataValueField = "LT_VALUE_DESC";

               ddlSelectedLookupValue.DataSource = dtLTValue;


    bool found = false;

                //Loop through the custom field rows

                foreach (WebSvcProject.ProjectDataSet.ProjectCustomFieldsRow CFrow in lo_projDS.ProjectCustomFields)


                    if (CFrow.MD_PROP_UID == cfId)


                        //Update field value

                        //CFrow.TEXT_VALUE = cfValue;

                        //CFrow.CODE_VALUE = selectedLookupValue.ToString();

                        CFrow.TEXT_VALUE = selectedLookupValue.ToString();

                        found = true;




    Request you to help in this.



  47. Hi Shravan, you cannot update the text value of a custom field that uses a lookup table – you can only update the code value – which will then use the appropriate text from the lookup table in PWA and Project Pro as appropriate..  So you need to get the code value of the lookup text you want to set and set that.  I'm sure I had a sample in another blog post – I'll see if I can find it.

    Best regards,


Skip to main content