LookupTable.UpdateLookupTables method

Office 2013 and later

Creates, modifies, or deletes data in custom field lookup tables. UpdateLookupTables creates lookup tables and corresponding code masks if the LookupTableDataSet includes new lookup tables, modifies existing lookup tables, and deletes lookup tables that are not in the LookupTableDataSet.

Namespace:  WebSvcLookupTable
Assembly:  ProjectServerServices (in ProjectServerServices.dll)

<SoapDocumentMethodAttribute("http://schemas.microsoft.com/office/project/server/webservices/LookupTable/UpdateLookupTables", RequestNamespace := "http://schemas.microsoft.com/office/project/server/webservices/LookupTable/",  _
	ResponseNamespace := "http://schemas.microsoft.com/office/project/server/webservices/LookupTable/",  _
	Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Sub UpdateLookupTables ( _
	ltds As LookupTableDataSet, _
	validateOnly As Boolean, _
	autoCheckIn As Boolean, _
	language As Integer _
Dim instance As LookupTable
Dim ltds As LookupTableDataSet
Dim validateOnly As Boolean
Dim autoCheckIn As Boolean
Dim language As Integer

instance.UpdateLookupTables(ltds, validateOnly, _
	autoCheckIn, language)


Type: WebSvcLookupTable.LookupTableDataSet

LookupTableDataSet with data in the datatables.

Type: System.Boolean

Validate only, do not update.

Type: System.Boolean

If true, check in after update.

Type: System.Int32

Locale ID (LCID).

UpdateLookupTables updates data in existing lookup tables. To create or delete lookup tables, you can also use CreateLookupTables and DeleteLookupTables.

To delete a lookup table value, first use the ReadLookupTablesByUids method to get a complete LookupTableDataSet, and then use the LookupTableDataSet.LookupTableTrees.Rows[index].Delete method, which marks the row for deletion. See the Example section.

To update one or more lookup tables, use ReadLookupTablesByUids to get all of the data tables necessary for each lookup table, and then modify the returned LookupTableDataSet to use for the ltds parameter in UpdateLookupTables.

You can also use ReadLookupTables with a null reference (Nothing in Visual Basic) for the xmlFilter parameter. In the following example, lookupTable is an instance of the LookupTableWebService.LookupTable class, and lookupTableDataSet is an instance of a LookupTableDataSet.

bool autoCheckOut = false;
string xmlFilter = null;
int language = 0;
lookupDataSet = lookupTable.ReadLookupTables(xmlFilter, autoCheckOut, language);
// Add, delete, or modify lookup table rows 
bool validateOnly = false;
autoCheckOut = true;
lookupTable.UpdateLookupTables(lookupTableDataSet, validateOnly, autoCheckOut, language);
// Call lookupTable.CheckInLookupTables

If you use ReadLookupTables and specify xmlfilter values, you may not get all of the tables necessary for an update. In that case, UpdateLookupTables results in a general unhandled exception.

Caution noteCaution

When you use the PSI to create or update a number lookup table, do not add values that have more than two decimal places.

The UpdateLookupTables method enables you to save a number with more than two decimal places. When you create a custom field that uses the number lookup table, Project Professional 2010 rounds the number custom field values to two decimal places and shows them as strings in the drop-down list to select a value. When you select a value, Project Professional 2010 converts the string back to a number. The process shows an error, because the numeric value with only two decimal places does not exist.

Project Server Permissions




Allows the user to modify the definitions of enterprise custom fields and lookup table values. Global permission.

The following example reads a specified lookup table and deletes a specified row in the table. The lookupTable parameter in the DeleteLookupTableRow sample method is a LookupTable object with valid Url and Credentials properties. The language parameter is an integer for the LCID; for example, 1033 is U.S. English. LookupTableWebSvc is an arbitrary reference name to the LookupTable.asmx Web service. For more information about using the code sample, see Prerequisites for ASMX-based code samples in Project 2013.

public string DeleteLookupTableRow(SvcLookupTable.LookupTable lookupTable,
    Guid lutGuid, int row, int language)
    string result = "";
    string fmtResult = "Lookup table: {0}. ";
    string tableName = "[unknown]";
    string rowName = "";

    SvcLookupTable.LookupTableDataSet lutDs = new SvcLookupTable.LookupTableDataSet();

    Guid[] lutList = new Guid[] { lutGuid };
    bool autoCheckOut = false;

    lutDs = lookupTable.ReadLookupTablesByUids(lutList, autoCheckOut, language);
    int numRows = lutDs.LookupTableTrees.Rows.Count;

    foreach (DataRow lutRow in lutDs.LookupTables)
        if ((Guid)lutRow[lutDs.LookupTables.LT_UIDColumn] == lutGuid)
            tableName = (string)lutRow[lutDs.LookupTables.LT_NAMEColumn];

    if (row < numRows)
        rowName = lutDs.LookupTableTrees[row].LT_VALUE_TEXT;

        bool validateOnly = false;
        lookupTable.UpdateLookupTables(lutDs, validateOnly, autoCheckOut, language);
        bool forceCheckIn = false;
        lookupTable.CheckInLookupTables(lutList, forceCheckIn);

        fmtResult += "Row {1} deleted: {2}";
        result = string.Format(fmtResult, tableName, row, rowName);
        fmtResult += "Requested row {1} greater than number of rows {2}.";
        result = string.Format(fmtResult, tableName, row, numRows);
    return result;


Other resources

Walkthrough: Creating a Hierarchical Lookup Table