CustomFieldDataSet.CustomFieldsRow.MD_PROP_TYPE_ENUM - Propriété

Obtient ou définit le type du champ personnalisé.

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

Syntaxe

'Déclaration
Public Property MD_PROP_TYPE_ENUM As Byte
    Get
    Set
'Utilisation
Dim instance As CustomFieldDataSet.CustomFieldsRow
Dim value As Byte

value = instance.MD_PROP_TYPE_ENUM

instance.MD_PROP_TYPE_ENUM = value
public byte MD_PROP_TYPE_ENUM { get; set; }

Valeur de propriété

Type : System.Byte
Un type de champ personnalisé.

Remarques

[MD_PROP_TYPE_ENUM] peut être un des types de champ personnalisés suivants : coût, DATE, durée, indicateur, nombre ou texte. Uniquement un champ personnalisé de type texte peut avoir une table de choix hiérarchique. Un champ personnalisé de type indicateur ne peut pas utiliser une table de choix. La valeur [MD_PROP_TYPE_ENUM] avec l'énumération Microsoft.Office.Project.Server.Library.CustomField.Type .

Exemples

L'exemple suivant utilise CustomFieldWS comme nom d'une référence web au service web Champs personnalisés (https://ServerName/ProjectServerName/_vti_bin/psi/CustomFields.asmx). Le Gestionnaire d'événements btnCustomField_Click est pour un bouton dans une application de formulaire Windows, comme LoginDemo dans le téléchargement du Kit de développement de projet.

using PSLibrary = Microsoft.Office.Project.Server.Library;
. . .
private Guid customFieldUid;
. . .
private void btnCustomField_Click(object sender, EventArgs e)
{
    string cfName = "Test Task Cost";
    Guid entityTypeUid = new Guid(PSLibrary.EntityCollection.Entities.TaskEntity.UniqueId);
    lookupTableUid = Guid.Empty;
    ltRowDefaultUid = Guid.Empty;
    byte cfType = (byte)PSLibrary.CustomField.Type.COST;
    byte rollup = (byte)PSLibrary.CustomField.SummaryRollup.Sum;

    customFieldUid = CreateCustomField(
        customFields, cfName,
        entityTypeUid, lookupTableUid, ltRowDefaultUid,
        cfType, rollup);
}

// Test method for creating a custom field.
public Guid CreateCustomField(
    CustomFieldsWS.CustomFields customFields,
    string cfName,
    Guid entityTypeUid,
    Guid lookupTableUid,
    Guid ltRowDefaultUid,
    byte cfType,
    byte rollup
    )
{
    CustomFieldsWS.CustomFieldDataSet customFieldDataSet =
        new CustomFieldsWS.CustomFieldDataSet();
    CustomFieldsWS.CustomFieldDataSet.CustomFieldsRow cfRow =
        customFieldDataSet.CustomFields.NewCustomFieldsRow();
    Guid cfUid = Guid.NewGuid();

    cfRow.MD_PROP_UID = cfUid;
    cfRow.MD_AGGREGATION_TYPE_ENUM = rollup;
    cfRow.MD_ENT_TYPE_UID = entityTypeUid;
    cfRow.MD_PROP_NAME = cfName;
    cfRow.MD_PROP_IS_REQUIRED = false;
    cfRow.MD_PROP_IS_LEAF_NODE_ONLY = false;
    cfRow.MD_PROP_TYPE_ENUM = cfType;

    if (lookupTableUid == Guid.Empty)
        cfRow.SetMD_LOOKUP_TABLE_UIDNull();
    else
        cfRow.MD_LOOKUP_TABLE_UID = lookupTableUid;

    if (ltRowDefaultUid == Guid.Empty)
        cfRow.SetMD_PROP_DEFAULT_VALUENull();
    else
        cfRow.MD_PROP_DEFAULT_VALUE = ltRowDefaultUid;

    customFieldDataSet.CustomFields.Rows.Add(cfRow);

    try
    {
        bool validateOnly = false;
        bool autoCheckIn = true;
        customFields.CreateCustomFields(customFieldDataSet, validateOnly, autoCheckIn);
    }
    catch (SoapException ex)
    {
        // Add exception handler for ex.
        cfUid = Guid.Empty;
    }
    catch (Exception ex)
    {
        // Add exception handler for ex.
        cfUid = Guid.Empty;
    }
    return cfUid;
}

Voir aussi

Référence

CustomFieldDataSet.CustomFieldsRow classe

CustomFieldDataSet.CustomFieldsRow - Membres

WebSvcCustomFields - Espace de noms

Autres ressources

How to: Create an Enterprise Custom Field