I am fetching the workitems in TFS using following approach.
WorkItem workItem = workItemClient.getWorkItemByID(workItemId);
Now to get 'Created By' && 'Assigned To' , I am using fieldCollection
FieldCollection fieldCollection = workItem.getFields();
Field createdBy = fieldCollection.getField("Created By");
Field assignedTo = fieldCollection.getField("Assigned To");
the above approach always gives me the display name of user instead of unique user name (Account name).
To resolve the display name with username(account name), I am making a query to TFS server
tfsUser = identityManagementService.readIdentity(IdentitySearchFactor.DISPLAY_NAME, displayName, MembershipQuery.DIRECT,ReadIdentityOptions.NONE);
But this query return an error "
Multiple identities were found that matched the factor value 'display name'
Any Idea on how can we get the Account name of user instead of display name for work items in TFS