Frage

I am having trouble finding the local names for custom fields. I tried to use the PSI custom fields service, but no luck. It seems to just get the enterprise fields. I'm really not sure where it is hiding the local names.

I am able to get the custom fields from the ReadProjectDataSet call, but it does not contain the names of the custom fields.

here is my code, which I think was copied from the projtool sample:

 public static SvcCustomFields.CustomFieldDataSet ReadCustomFields( )
    {
        CheckAccess();

        using (var scope = new OperationContextScope(projectClient.InnerChannel))
        {
            ProjectAuthentication.UseCorrectHeaders(isImpersonated);

            return customFieldsClient.ReadCustomFields(string.Empty, false);
       }
    }

here is a screenshot of how it is appearing project desktop:

enter image description here

War es hilfreich?

Lösung

The code is like this:

CustomFieldDataSet cfDS = new CustomFieldDataSet();

PSLibrary.Filter cfFilter = new Microsoft.Office.Project.Server.Library.Filter();
cfFilter.FilterTableName = cfDS.CustomFields.TableName;

cfFilter.Fields.Add(new PSLibrary.Filter.Field(cfDS.CustomFields.TableName, cfDS.CustomFields.MD_PROP_NAMEColumn.ColumnName));
cfFilter.Fields.Add(new PSLibrary.Filter.Field(cfDS.CustomFields.TableName, cfDS.CustomFields.MD_PROP_IDColumn.ColumnName));
cfFilter.Fields.Add(new PSLibrary.Filter.Field(cfDS.CustomFields.TableName, cfDS.CustomFields.MD_PROP_UIDColumn.ColumnName));
cfFilter.Fields.Add(new PSLibrary.Filter.Field(cfDS.CustomFields.TableName, cfDS.CustomFields.MD_LOOKUP_TABLE_UIDColumn.ColumnName));
cfFilter.Fields.Add(new PSLibrary.Filter.Field(cfDS.CustomFields.TableName, cfDS.CustomFields.MD_PROP_TYPE_ENUMColumn.ColumnName));

cfDS = ReadCustomFields(cfFilter.GetXml(), false);

The sample was written as addition to CustomFieldsClient. It reads Name of a custom field, ID, UID, UID of Lookup table and Type of the field.

But it only reads name of the fields. There are user defined labels for the fields and the labels are defined in Project Pro and stored in Table definitions which are available through Project Pro only.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top