Work Item object model - problem with editing new reference field

Hi,

I'm using the sample from the SDK about WI object model.

The thing is that I customized my work item to have some new fields, for example I added value caled - Category ,The reference path is MyCompany.MyProcess.Category When i'm trying to set values on my workitem i get error on the fields that they are not build in fields.

In example this line will work :workItem.Title ="Edited " +DateTime.Now.ToString();

But for this line I'll get an error : workItem.Category = "ERP";

Thanks in advance,

Shmulik.

[775 byte] By [shmulik_segal] at [2008-2-15]
# 1

Hi Shmulik,
You can use the following:

if(workItem.Fields.Contains("MyCompany.MyProcess.Category"))
workItem.Fields["MyCompany.MyProcess.Category"].Value = "ERP";

Regards,
Sinc at devBiz

SincatdevBiz at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Work Item Tracking...
# 2
Thank you very much.
shmulik_segal at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Work Item Tracking...

Visual Studio Team System

Site Classified