2016-03-23 13 views

cevap

0

kod aşağıda kullanarak TFS çalışma öğelerini görüntülemek mümkün duyuyorum:

public static TFSTeamProjectCollection connectToTFS() throws URIException, SQLException 
{ 
    TFSTeamProjectCollection tpc = null; 
    Credentials credentials; 

    credentials = new UsernamePasswordCredentials("username,"password"); 
    tpc = new TFSTeamProjectCollection(URIUtils.newURI("http://0.0.0.127:8080/tfs/DefaultCollection"), credentials); 
    return tpc; 
} 


// get connection using above method 
TFSTeamProjectCollection tpc=connectToTFS(); 
WorkItemClient workItemClient = tpc.getWorkItemClient(); 
// Define the WIQL query.   
String wiqlQuery = "Select ID, Title from WorkItems where (State = 'Active') order by Title"; 

// Run the query and get the results.   
WorkItemCollection workItems = workItemClient.query(wiqlQuery); 
final int maxToPrint = 20; 

for (int i = 0; i < workItems.size(); i++)   
{ 
    if (i >= maxToPrint)    
    { 
     System.out.println("[...]");     
     break; 
    } 
    WorkItem workItem = workItems.getWorkItem(i); 

    System.out.println(workItem.getID()); 
    System.out.println(workItem.getTitle()); 
    System.out.println(workItem.getProject().getName()); 
    System.out.println(workItem.getClient().getUserDisplayName());   
} 
0

tam olarak assign_to alan değeri elde edebilirsiniz tabloların altında kullanma.

for (int i = 0; i < workItems.size(); i++)   
    { 

     WorkItem workItem = workItems.getWorkItem(i); 

     workItem.syncToLatest(); 
      System.out.println("task assigned to "+ workItem.getFields().getField("Assigned to").getValue()+" Task title is "+workItem.getFields().getField("title").getOriginalValue()); 


    } 
İlgili konular