Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

LookupTable.CreateLookupTables method

Creates custom field lookup tables and corresponding code masks.

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

[SoapDocumentMethodAttribute("http://schemas.microsoft.com/office/project/server/webservices/LookupTable/CreateLookupTables", 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 void CreateLookupTables(
	LookupTableDataSet ltds,
	bool validateOnly,
	bool autoCheckIn
)

Parameters

ltds
Type: WebSvcLookupTable.LookupTableDataSet

LookupTableDataSet containing data in the datatables.

validateOnly
Type: System.Boolean

Validate only, do not create.

autoCheckIn
Type: System.Boolean

If true, check in after creating.

If you create a non-text lookup table such as type Cost, Date, Duration, or Number, you still need to programmatically create a code mask. Project Web App hides the code mask for non-text lookup tables in the New Lookup Table page, but creates a code mask for the call to CreateLookupTable. For an example that creates a Duration lookup table, see CreateLookupTablesMultiLang. For more examples, see Using the ProjTool Test Application.

The pre-event for CreateLookupTables is LookupTableEventReceiver.OnCreating and the post-event is OnCreated.

NoteNote

The pre- and post-events for CreateLookupTables expose LookupTableMultiLangDataSet in the e parameter of event handlers, rather than a LookupTableDataSet.

To use datasets in event handlers, set a reference to the Microsoft.Office.Project.Schema.dll assembly. For more information, see How to: Write and Debug a Project Server Event Handler. For more examples, see Using the ProjTool Test Application.

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

Permission

Description

ManageEnterpriseCustomFields

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

The following code is a pre-event handler for CreateLookupTables that gets data from different tables in a LookupTableMultiLanguageDataSet.

using PSLibrary = Microsoft.Office.Project.Server.Library;
. . .
public class LookupTableEvents : LookupTableEventReceiver
{
    public override void OnCreating(PSLibrary.PSContextInfo contextInfo, 
        LookupTablePreEventArgs e)
    {
        int lutLanguage = 
            (int)e.LookupTableInformation.LookupTableLanguages.Rows[0]["LCID"];
        Guid lutMultiUid = 
            (Guid)e.LookupTableInformation.LookupTables.Rows[0]["LT_UID"];
        string lutMultiValue = 
            (string)e.LookupTableInformation.LookupTableValues.Rows[0]["LT_VALUE_TEXT"];
        . . .
}
Show:
© 2015 Microsoft