How to get user information using the Team Foundation Server (TFS) java SDK

I am trying to access TFS user data (profile details) for all users who have performed actions on the TFS server. I am currently only getting the username using the Assigned or Created fields.

I am trying to get the user id using the following code.

IIdentityManagementService  identityManagementService = (IIdentityManagementService)tpc.getConfigurationServer().getWebService(IdentityManagementService.class);
TeamFoundationIdentity UserID = identityManagementService.readIdentity(IdentitySearchFactor.DISPLAY_NAME,
                    "Chunky Garg", MembershipQuery.DIRECT, ReadIdentityOptions.EXTENDED_PROPERTIES);

      

Using the above code, I am getting the following exception

Exception in thread "main" com.microsoft.tfs.core.config.webservice.UnknownWebServiceException: Unknown web service: [com.microsoft.tfs.core.clients.webservices.IdentityManagementService]
    at com.microsoft.tfs.core.config.webservice.DefaultWebServiceFactory.newWebService(DefaultWebServiceFactory.java:226)
    at com.microsoft.tfs.core.TFSConnection.getWebService(TFSConnection.java:891)
    at tfs.TFSTest.main(TFSTest.java:93)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

      

Please let me know if this is a bug in the java SDK or if I am doing something wrong.

TFS version - using cloud version JAVA SDK - 12.0.2 OS: MacOSX

+3


source to share





All Articles