Create Lookup type Custom Field using PSI Project Server

Create Lookup type Custom Field using PSI Project Server:-

Create Lookup type Custom Field using PSI Project Server. In this post, I will describe you to Create Lookup type Custom Field using PSI. Custom Fields can include custom formulas and can have lookup tables and graphical indicators.

Step 1: Go to Project Web App home page, shown click Project Web App Settings.
Step 2: click Enterprise Custom fields and Lookup Tables in the section Enterprise Data.
step 3: click New Field to create a new Custom Field in the section Enterprise Custom Fields.
Step 4: Type a unique name for the custom field box for a Custom Field.
Step 5: Fill out the New Custom Field web page and Click Save

If you don’t know how to add service reference then follow my post. Add PSI Web Reference in Solution file

Create Lookup type Custom Field using PSI Project Server

Below is shown the needed namespace:-

Create Lookup type Custom Field using PSI

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using SvcCustomFields;
using PSLibrary = Microsoft.Office.Project.Server.Library;

namespace Lookup_Type_CustomField
    class Program

        public static SvcCustomFields.CustomFieldsClient customFieldClient;
        public static string PWAURL = "http://ServerName/PWAPath/";
        static void Main(string[] args)
            string cfName = "LookUpTypeCustomField";
            Guid lookupTable_GUID = new Guid("e7397277-1ab0-4096-b2dd-57029a055ba4"); //Existing LookUp Table GUID
            Guid ltRowDefaultUid = Guid.Empty;
            CustomFieldDataSet customField_DataSet = new CustomFieldDataSet();

            CustomFieldDataSet.CustomFieldsRow CustomfieldRow = customField_DataSet.CustomFields.NewCustomFieldsRow();
            Guid cfUid = Guid.NewGuid();
            CustomfieldRow.MD_PROP_UID = cfUid;
            Guid entityType_Uid = new Guid(PSLibrary.EntityCollection.Entities.ProjectEntity.UniqueId); //Define Entity of custom field like project label,Task label etc. For task label write-PSLibrary.EntityCollection.Entities.TaskEntity.UniqueId
            CustomfieldRow.MD_ENT_TYPE_UID = entityType_Uid;
            CustomfieldRow.MD_PROP_NAME = cfName;
            CustomfieldRow.MD_PROP_IS_REQUIRED = false;
            CustomfieldRow.MD_PROP_IS_LEAF_NODE_ONLY = false;
            CustomfieldRow.MD_PROP_TYPE_ENUM = (byte)PSLibrary.CustomField.Type.TEXT; //Define type of custom field
            CustomfieldRow.MD_LOOKUP_TABLE_UID = lookupTable_GUID;

            if (ltRowDefaultUid == Guid.Empty)
                CustomfieldRow.MD_PROP_DEFAULT_VALUE = ltRowDefaultUid;


                bool validateOnly = false;
                bool autoCheckIn = true;
                customFieldClient.CreateCustomFields(customField_DataSet, validateOnly, autoCheckIn);
            catch (Exception ex)




Click Here to Download Code

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 !!