You can use the IIdentityManagementService2
(http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.framework.client.iidentitymanagementservice2.aspx) in order to get details about the identity using the display name. You can get the service in the same fashion as you would get the WorkItemStore
from the project collection object using TfsTeamProjectCollection.GetService<IIdentityManagementService2>()
. If you cast the AssignedTo
value into a string, you can use the following code to get the identity:
var identity = identityService.ReadIdentity(
IdentitySearchFactor.DisplayName,
assignedTo,
MembershipQuery.Direct,
ReadIdentityOptions.ExtendedProperties);
Where assignedTo
would be the value of the display name that you retrieve from the field in the work item.