Partager via


LookupTable.CreateLookupTablesMultiLang - Méthode

Crée des tables de choix multilingue de champ personnalisé et de masques de code correspondant.

Espace de noms :  WebSvcLookupTable
Assembly :  ProjectServerServices (dans ProjectServerServices.dll)

Syntaxe

'Déclaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/LookupTable/CreateLookupTablesMultiLang", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/LookupTable/",  _
    ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/LookupTable/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Sub CreateLookupTablesMultiLang ( _
    ltds As LookupTableMultiLangDataSet, _
    validateOnly As Boolean, _
    autoCheckIn As Boolean _
)
'Utilisation
Dim instance As LookupTable
Dim ltds As LookupTableMultiLangDataSet
Dim validateOnly As Boolean
Dim autoCheckIn As Boolean

instance.CreateLookupTablesMultiLang(ltds, _
    validateOnly, autoCheckIn)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/LookupTable/CreateLookupTablesMultiLang", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/LookupTable/", 
    ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/LookupTable/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void CreateLookupTablesMultiLang(
    LookupTableMultiLangDataSet ltds,
    bool validateOnly,
    bool autoCheckIn
)

Paramètres

  • validateOnly
    Type : System.Boolean

    Valider uniquement, ne créez pas.

  • autoCheckIn
    Type : System.Boolean

    Si true, archiver après la création.

Remarques

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 on the New Lookup Table page, but creates a code mask for the call to CreateLookupTable. The Example section includes sample code that creates a Duration lookup table. For more examples, see Using the ProjTool Test Application.

L'événement avant de CreateLookupTables est LookupTableEventReceiver.OnCreating et le pré-événement est OnCreated.

Par exemple, le paramètre e dans un gestionnaire d'événements OnCreating expose un objet LookupTableMultiLanguageDataSet . Le code suivant montre des exemples illustrant comment obtenir des données provenant de différentes tables comme LookupTableLanguages, LookupTableset LookupTableValues.

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"];
        . . .
    }

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.

Avertissement

Lorsque vous utilisez l'interface PSI pour créer ou mettre à jour d'une table de choix numérique, n'ajoutez pas de valeurs qui ont plus de deux décimales.

La méthode CreateLookupTablesMultiLang vous permet d'enregistrer un nombre avec plus de deux décimales. Lorsque vous créez un champ personnalisé qui utilise la table de choix numérique, Project Professionnel 2010 arrondit les valeurs de champ personnalisé nombres à deux décimales et les affiche sous forme de chaînes dans la liste déroulante pour sélectionner une valeur. Lorsque vous sélectionnez une valeur, Project Professionnel 2010 convertit la chaîne à un nombre. Le processus décrit une erreur, car la valeur numérique avec seulement deux décimales n'existe pas.

Autorisations Project Server

Autorisation

Description

ManageEnterpriseCustomFields

Permet à un utilisateur de modifier les définitions des champs personnalisés d'entreprise et les valeurs de table de choix. Autorisation globale.

Exemples

The following code fragment creates a lookup table named Test Duration LUT of type Duration. LookupTableWS is an arbitrary name for a reference to the LookupTable Web service. To test the code, add it to a sample console application. For more information, see Prerequisites for ASMX-Based Code Samples.

Les commentaires incluent les noms des tables modifiés dans la base de données publiée après l'appel à CreateLookupTablesMultiLang.

using PSLibrary = Microsoft.Office.Project.Server.Library;
. . .
private const string LOOKUPTABLEWEBSERVICE = "_vti_bin/PSI/LookupTable.asmx";
private string baseUrl = "https://ServerName/ProjectServerName"/
private static WebSvcLookupTable.LookupTable lookupTable =
    new WebSvcLookupTable.LookupTable();
LookupTableWS.LookupTableMultiLangDataSet lutMultiDS = 
    new LookupTableWS.LookupTableMultiLangDataSet();

// Initialize the LookupTable Web service for Windows logon.
lookupTable.Url = baseUrl + LOOKUPTABLEWEBSERVICE;
lookupTable.Credentials = CredentialCache.DefaultCredentials;
. . .
private void btnCreateNonTextLUT_Click(object sender, EventArgs e)
{
    LookupTableWS.LookupTableMultiLangDataSet lutMultiDS = 
        new LookupTableWS.LookupTableMultiLangDataSet();

    // Create the main LookupTable row in MSP_LOOKUP_TABLES.
    LookupTableWS.LookupTableMultiLangDataSet.LookupTablesRow lutMainRow =
        lutMultiDS.LookupTables.NewLookupTablesRow();
    lutMainRow.LT_UID = Guid.NewGuid();
    lutMainRow.LT_FILL_ALL_LEVELS = false;
    lutMainRow.LT_PRIMARY_LCID = 1033;
    lutMainRow.LT_SORT_ORDER_ENUM = (byte)PSLibrary.LookupTables.SortOrder.Ascending;
    lutMainRow.LT_NAME = "Test Duration LUT";
    lutMultiDS.LookupTables.Rows.Add(lutMainRow);

    // Create the 1-level mask structure in MSP_LOOKUP_TABLE_MASK_STRUCTURES.
    LookupTableWS.LookupTableMultiLangDataSet.LookupTableMaskStructuresRow lutMaskStructureRow =
        lutMultiDS.LookupTableMaskStructures.NewLookupTableMaskStructuresRow();
    lutMaskStructureRow.LT_UID = lutMainRow.LT_UID;
    lutMaskStructureRow.LT_MASK_STRUCT_LENGTH = (int)PSLibrary.LookupTables.ANY_LENGTH_SEQUENCE;
    lutMaskStructureRow.LT_MASK_STRUCT_LEVEL = 1;
    lutMaskStructureRow.LT_MASK_STRUCT_TYPE_ENUM = (byte)PSLibrary.LookupTables.MaskSequence.DURATION;
    lutMultiDS.LookupTableMaskStructures.Rows.Add(lutMaskStructureRow);

    // Create the 1-level mask value in MSP_LOOKUP_TABLE_MASK_VALUES.
    LookupTableWS.LookupTableMultiLangDataSet.LookupTableMaskValuesRow lutMaskValueRow =
        lutMultiDS.LookupTableMaskValues.NewLookupTableMaskValuesRow();
    lutMaskValueRow.LCID = 1033;
    lutMaskValueRow.LT_UID = lutMainRow.LT_UID;
    lutMaskValueRow.LT_MASK_STRUCT_LEVEL = 1;
    lutMaskValueRow.LT_MASK_VALUE_SEPARATOR = ".";
    lutMultiDS.LookupTableMaskValues.Rows.Add(lutMaskValueRow);

    // Create the value structure in MSP_LOOKUP_TABLE_STRUCTURES.
    LookupTableWS.LookupTableMultiLangDataSet.LookupTableStructuresRow lutStructureRow =
        lutMultiDS.LookupTableStructures.NewLookupTableStructuresRow();
    lutStructureRow.LT_UID = lutMainRow.LT_UID;
    lutStructureRow.LT_STRUCT_UID = Guid.NewGuid();
    lutMultiDS.LookupTableStructures.Rows.Add(lutStructureRow);

    // Create values (one value per LCID) in MSP_LOOKUP_TABLE_VALUES.
    LookupTableWS.LookupTableMultiLangDataSet.LookupTableValuesRow lutValueRow =
        lutMultiDS.LookupTableValues.NewLookupTableValuesRow();
    lutValueRow.LCID = 1033;
    lutValueRow.LT_VALUE_DESC = "This is root level A";
    lutValueRow.LT_VALUE_DUR = 30;
    lutValueRow.LT_VALUE_DUR_FMT = (byte)PSLibrary.Task.DurationFormat.Hour;
    lutValueRow.LT_STRUCT_UID = lutStructureRow.LT_STRUCT_UID;
    lutMultiDS.LookupTableValues.Rows.Add(lutValueRow);

    // Create the lookup table.
    bool validateOnly = false;
    bool autoCheckIn = true;
    lookupTable.CreateLookupTablesMultiLang(lutMultiDS, validateOnly, autoCheckIn);
}

Voir aussi

Référence

LookupTable classe

LookupTable - Membres

WebSvcLookupTable - Espace de noms

CreateLookupTables

Autres ressources

How to: Write and Debug a Project Server Event Handler

Using the ProjTool Test Application