CustomFieldDataSet.CustomFieldsRow.MD_AGGREGATION_TYPE_ENUM 属性

获取或设置自定义的字段的汇总类型。

命名空间:  WebSvcCustomFields
程序集:  ProjectServerServices(位于 ProjectServerServices.dll 中)

语法

声明
Public Property MD_AGGREGATION_TYPE_ENUM As Byte
    Get
    Set
用法
Dim instance As CustomFieldDataSet.CustomFieldsRow
Dim value As Byte

value = instance.MD_AGGREGATION_TYPE_ENUM

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

属性值

类型:System.Byte
一个表示汇总类型的数字。

备注

设置 MD_AGGREGATION_TYPE_ENUM 与CustomField.SummaryRollup枚举。

示例

下面的示例使用CustomFieldWS作为对Custom Fields (https://ServerName/ProjectServerName/_vti_bin/psi/CustomFields.asmx) web 服务的 web 引用的名称。btnCustomField_Click事件处理程序是一个 Windows 窗体应用程序中,如LoginDemo项目的 SDK 下载中的按钮。

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;
}

另请参阅

引用

CustomFieldDataSet.CustomFieldsRow 类

CustomFieldDataSet.CustomFieldsRow 成员

WebSvcCustomFields 命名空间

其他资源

How to: Create an Enterprise Custom Field