Update Custom Field Value Using CSOM in Project Online

Update Custom Field Value Using CSOM:

In this post, I will explain to you how to update custom field value using CSOM. We can update a custom field value in respective projects. All the custom fields on PWA will show on Project Details Page with an empty value. If a custom field has a Default value then will show on every project. And you can update it on every project.

You need to set custom field value as

Custom_b50f29a9881de61180d700155d1c581a=Custom_(Your Custom Field GUID without hyphen)

projCheckedOut.SetCustomFieldValue("Custom_7ad42d64-8949-e611-80df-00155d1c6619", "CustoFieldValue");

Get custom field value using CSOM

foreach (var cust in item.IncludeCustomFields.FieldValues)
                            string CustomFieldName = item.IncludeCustomFields.CustomFields.ToList().Where(pr => pr.InternalName == cust.Key).ToList().Count == 0 ? string.Empty : item.IncludeCustomFields.CustomFields.ToList().Where(pr => pr.InternalName == cust.Key).ToList()[0].Name;
                            string CustomFieldID = cust.Key.ToString();
                            string CustomFieldValue = cust.Value.ToString();

Read Custom Field Value Using CSOM in Project Online

Get Custom Field Value using JavaScript Object Model(JSOM)


using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.ServiceModel;
using System.Data;
using Microsoft.ProjectServer.Client;
using Microsoft.SharePoint.Client;
using System.Security;

namespace Update_Custom_Field_Using_CSOM
    class Program
        static string UserName = "UserName";
        static string Passwords = "Password";
        public static string OnlinePWA = "PWAPath";
        static void Main(string[] args)
         private static void UpdateCustomField()
            using (ProjectContext ProjectCont = new ProjectContext(OnlinePWA))//PWA Url
                SecureString passWord2 = new SecureString();
                foreach (char c in Passwords.ToCharArray()) passWord2.AppendChar(c);
                ProjectCont.Credentials = new SharePointOnlineCredentials(UserName, passWord2);
                c => c.IncludeWithDefaultProperties(pr => pr.StartDate, pr => pr.CustomFields, pr => pr.Assignments, pr => pr.FinishDate, pr => pr.Owner.LoginName, pr => pr.Tasks, pr => pr.ProjectSiteUrl, pr => pr.PercentComplete, pr => pr.ProjectResources, pr => pr.CustomFields, pr => pr.EnterpriseProjectType));
                var projectColl = ProjectCont.LoadQuery(ProjectCont.Projects.Where(p => p.Name == "Project Name"));
                PublishedProject pubProj = projectColl.First();
                DraftProject draft = pubProj.Draft;
                JobState job1 = ProjectCont.WaitForQueue(draft.CheckIn(true), 20);
                DraftProject projCheckedOut = pubProj.CheckOut();
                projCheckedOut.Name = "Project Name";
                projCheckedOut.Description = "This content updated by ProjectServerCode";
                projCheckedOut.SetCustomFieldValue("Custom_7ad42d64-8949-e611-80df-00155d1c6619", "CustoFieldValue");
                //Note:Custom_b50f29a9881de61180d700155d1c581a=Custom_(Your Custom Field GUID without hyphen)
                JobState jobState = ProjectCont.WaitForQueue(ProjectCont.Projects.Update(), 10);





  1. Hi,

    Thanks for this post but I am looking for a sample code for updating a task. For example, I want to update the field “Actual Cost” from $10 to $100, is there any way to achieve that?

    Thanks in advance!


  2. nice post helped me a lot. thanks
    Would you tell me please how to update lookup type custom field using csom

      1. Hi,

        Below code condition is checking whether that project is checked out or not.

        Doubut : if the Project is already checkedOut aslo i shout update the custom field.

        can you suggest me for the above.

        if (!pubProj.IsCheckedOut)

        //else condittion will work if the project is checkedout.
        // can we update the same custom field here ?


        1. Hello Raghava,
          else condition will not work because the project is check out. so before to update the custom field value you have to checkIn and checkout the project and then update it. below is some code of line you have to add for checkIn the project
          DraftProject draft = pubProj.Draft;
          JobState job1 = ProjectCont.WaitForQueue(draft.CheckIn(true), 20);

          These lines i am adding in my code also.

  3. Hi admin,

    the code is working fine but in the Manage Queue jobs ( Job state ) is ” Failed But Not Blocking Correlation”

    On pwa site every project custom fields update we are getting one mail as like below message.

    Your ProjectCheckIn job failed. Its current state is FailedNotBlocking. It was 0 complete. It entered the queue at 11/16/2016 04:23:30.
    The errors returned from the queue are as follows:
    Error ID: 10102
    Error ID: 26000

    Detailed error below – send it to the administrator for more detailed troubleshooting.

    You can do the following:
    1. Try troubleshooting using the error IDs, error XML.
    2. Contact administrator with your jobID (b119c178-f7ab-e611-80ce-00155d50d12b) and error XML.

    kindly suggest for this.


  4. projCheckedOut.Publish(false);

    Error is not coming in Manage Queue jobs but after 1 or 2 days ( job state in the manage queue jobs is cancelled ) and error details is below.

    ProjectPublishFailure (23000). Details: id=’23000′
    GeneralQueueJobFailed (26000) – ProjectPublish.PublishProjectMessage. Details: id=’26000′
    For more details, check the ULS logs on machine a01fbc47-3956-4d93-beaf-71fcadbef092 for entries with JobUID 8e8047cb-4eaa-e611-80d1-00155da0360e.

    please suggest me to fix this issue.


  5. Hello,I read your blogs named “Update Custom Field Value Using CSOM – SharePoint & Project server tutorials 2013” like every week.Your story-telling style is witty, keep it up! And you can look our website about تحميل اغانى.

  6. Hi,

    Thanks for your post! it helped me a lot! Question, can project Level data be updated, so the PDP should the update, without having to Publish the schedule? Currently your code seems to force the schedule to be published, some PMs want to keep the control of when the schedule is published, but we still need to update some Project Level information for accurate reporting.


  7. Hi,

    Can you help me to get list of checkout objects like (Lookup tables and custom fields) using CSOM ?

    and how can we force checkin Lookup table and custom fields using CSOM ?

    Please suggest me to get solution for above.

  8. Hi,
    Sometimes i am getting CICONotCheckedOut error. Even i have increased the number of timeout seconds in WaitForQueue method.

  9. Hi,

    Sometimes i am getting CISONotCheckedOut Error. Even i have increased the number of timeout seconds in WaitForQueue method.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!