The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

LookupTable.UpdateLookupTables Method

Office 2007

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:  ProjectServerWebServices (in ProjectServerWebServices.dll)

[SoapDocumentMethodAttribute("", RequestNamespace = "", 
	ResponseNamespace = "", 
	Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void UpdateLookupTables(
	LookupTableDataSet ltds,
	bool validateOnly,
	bool autoCheckIn,
	int 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.

Project Server Permissions




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 Reference Code Samples.

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

    LookupTableWebSvc.LookupTableDataSet lutDs = new LookupTableWebSvc.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;

Community Additions