Yanıt Issue In Query with TFS java api

  • 17 Nisan 2012 Salı 13:06
     
     

    Hi,

    I am trying to query issue from TFS using Java API. Below is code for the same :

    TFSTeamProjectCollection tpc = new TFSTeamProjectCollection("http://localhost:8080/tfs/DefaultCollection","user","domain","password");
            Project project = tpc.getWorkItemClient().getProjects().get("TestProject");
            
            WorkItemClient workItemClient = project.getWorkItemClient();
            
            Query query = workItemClient.createQuery("Select * from WorkItems where (State = 'Active') order by Title");
            WorkItemCollection itemCollection = query.runQuery();

    On Query execution it shows following error:

    Exception in thread "main" java.lang.IllegalArgumentException: fieldDefinition [System.AreaLevel1(-43)] is not queryable
        at com.microsoft.tfs.core.clients.workitem.internal.query.DisplayFieldListImpl.add(DisplayFieldListImpl.java:40)
        at com.microsoft.tfs.core.clients.workitem.internal.wiqlparse.WIQLAdapter.getDisplayFieldList(WIQLAdapter.java:471)
        at com.microsoft.tfs.core.clients.workitem.internal.query.QueryImpl.initialize(QueryImpl.java:533)
        at com.microsoft.tfs.core.clients.workitem.internal.query.QueryImpl.<init>(QueryImpl.java:73)
        at com.microsoft.tfs.core.clients.workitem.WorkItemClient.createQuery(WorkItemClient.java:506)
        at com.opshub.eai.tfs.common.TFSJavaClient.main(TFSJavaClient.java:20)

    The above error comes everytime if i do select * instead of individual fields.

    Any reasons for the same ?

    Thanks,

    riddhi shah

Tüm Yanıtlar

  • 17 Nisan 2012 Salı 14:24
     
     

    Seems like a bug in the API, it should not add fields if they're not supported by the query. If you can, please verify if this still happens with the TFS 11 api's. 

    Whatever the result, post a bug on connect.


    My blog: blog.jessehouwing.nl

  • 17 Nisan 2012 Salı 14:35
     
     

    Thanks Jesse.

    Unfortunately, I do not have TFS 2011 setup.

    Also, we want to use TFS Java API for TFS 2010.

    Regards,

    Riddhi Shah

  • 17 Nisan 2012 Salı 15:29
     
     Yanıt
    The TFS 11 API's will connect to TFS 2010 as well. But regardless, you should file a bug on connect for this.

    My blog: blog.jessehouwing.nl

    • Yanıt Olarak İşaretleyen ShahRiddhi 25 Mayıs 2012 Cuma 06:28
    •  
  • 18 Nisan 2012 Çarşamba 03:48
    Moderatör
     
     Yanıt

    Hello Riddhi,

    Do you mean you only get the error message by using the query "Select * from WorkItems where (State = 'Active') order by Title"? If you modify your query to be "Select ID, Title from WorkItems where (State = 'Active') order by Title" you can't run your code successfully? If so, I agree with Jesse that you should submite one feedback on the Microsoft Connect site.

    Thanks,


    Vicky Song [MSFT]
    MSDN Community Support | Feedback to us

    • Yanıt Olarak İşaretleyen ShahRiddhi 25 Mayıs 2012 Cuma 06:28
    •  
  • 18 Nisan 2012 Çarşamba 05:08
     
     

    Hi,

    If I modify my query to select particular columns, it does not give any error. The error comes only if I put "select *" in my query

    I will surely log a defect on the same to Microsoft Connect site.

    Thank you so much for your help.

    Regards,

    Riddhi Shah