pabrams
pabrams

Reputation: 1164

TFS API DefaultValue for AllowedValues

In my WITD, I have some xml like this in my FIELD tag:

<ALLOWEDVALUES expanditems="true">
  <LISTITEM value="Yes" />
  <LISTITEM value="No" />
</ALLOWEDVALUES>
<DEFAULT from="value" value="No" />

I can get the allowed values from the API by getting an instance of class FieldDefinition and referencing the AllowedValues property.

How can I get the DEFAULT tag's value from the Api?

Upvotes: 1

Views: 198

Answers (2)

KMoraz
KMoraz

Reputation: 14164

There's no API for retrieving default values. Another approach is to parse the value from the WITD XML using WorkItemType.Export Method

 var xml = wit.Export(false);

Upvotes: 1

Eric Johnson
Eric Johnson

Reputation: 1377

You could create a new work item with a work item type that has your field and then check the value of the field on the new work item. You don't need to save the work item to check the field value. It should contain the default value you are after.

Upvotes: 1

Related Questions