c# - how to write a code to get the value of Priority, triage etc which comes under DisplayForm in tfs -


below code how triage , priority values

tfsteamprojectcollection tpc = new tfsteamprojectcollection(               new uri("http://abc1.com"));             workitemstore workitemstore = (workitemstore)tpc.getservice(typeof(workitemstore));             workitemcollection queryresults = workitemstore.query("select [state], [title]  workitems [work item type] = 'task' , ([state] <> 'resolved' , [state] <> 'closed') , [assigned to] = 'test' , [keywordsearch] not contains 'test1'");  foreach (workitem queryresult in queryresults )             {                 int taskid = queryresult.id;                 int taskpriority = queryresult.displayform; // how value of priority                 string tasktriage = queryresult.displayform;//how value of triage                 string taskstate = queryresult.state;                 datetime taskchangeddate = queryresult.changeddate;                 string tasktitle = queryresult.title;             } 

have tried this? instead of field.name better compare field.referencename don't know reference name priority , tasktriage fields.

tfsteamprojectcollection tpc = new tfsteamprojectcollection(     new uri("http://server/tfs")); var workitemstore =  tpc.getservice<workitemstore>();  workitemcollection queryresults = workitemstore.query(     "select [state], [title]  workitems " +      " [work item type] = 'task' , " +      " ([state] <> 'resolved' , [state] <> 'closed') ");  foreach (workitem queryresult in queryresults) {     int taskid = queryresult.id;      //int taskpriority = queryresult.displayform; // how value of priority     //string tasktriage = queryresult.displayform;//how value of triage     foreach (field n in queryresult.fields)     {         if (n.name == "taskpriority")         {             int taskpriority = (int)n.value;          }         else if (n.name == "tasktriage")         {             string tasktriage = (n.value ?? string.empty ).tostring();          }      }       string taskstate = queryresult.state;      datetime taskchangeddate = queryresult.changeddate;      string tasktitle = queryresult.title; } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -