Question

I've been working on an extension for our TWA and a curious thing happened.
We have a library of functions for working with our custom Work Items, containing, among others, a function for updating a specific one - UpdateContract. In the course of my work I needed to extend one of the other custom Work Items (TeamTask) with an additional field.

Originally, the UpdateContract method worked no problem, but now it works only if I add an explicit call to item.Open() or item.PartialOpen() to it, otherwise it throws the following exception:

ValidationException:
TF400276: You have tried to set a value for a field of a work item which is not opened or partial opened. You cannot set a value for a field of a work item which is not opened or partial opened.

I'm retrieving Work Items of the same type from the web app, but never do I change them from there.

I'd be very happy if somebody could shed a bit of light into this, being totally new to TFS I have zero clue as to what is the cause of this.

Was it helpful?

Solution

The query that you use to retrieve the Work Item in question needs to specify your additional field in order for you to be able to update it.

By default when you query TFS it returns only the fields of the Work Item (in addition to the required ones) that you expicitly specify. If you don't specify the field that you want to change then you will require to use item.Open() in order to lazy load the entire work item data for editing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top