krabcore krabcore - 1 year ago 131
C# Question

How to change the value of CustomFields in Test-Case TFS API 2013?

I'm trying to make a utility for working with TFS and I get some values from testcases:


i show this values to the user, and after that i want to change this values. I tried:

testCase.CustomFields["Microsoft.VSTS.TCM.AutomationStatus"] = item.Value; // Error: The indexer has no setter
testCase.Priority = item.Value; // OK

How to change
in test-case with tfs api?

Answer Source

CustomFields is a FieldCollection who's indexer has no setter, however the indexer return a Field who's property Value has one

Just change:

testCase.CustomFields["Microsoft.VSTS.TCM.AutomationStatus"] = item.Value;


testCase.CustomFields["Microsoft.VSTS.TCM.AutomationStatus"].Value = item.Value;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download