What version of Visual Studio and TFS are you using? I use TFS2010 and VS2010, and the following code worked fine for me:
IIdentityManagementService ims = (IIdentityManagementService)_tfs.GetService(typeof(IIdentityManagementService)); TeamFoundationIdentity UserID = ims.ReadIdentity(IdentitySearchFactor.DisplayName,"Mike" , MembershipQuery.Direct, ReadIdentityOptions.None);
Not sure if the problem is just initializing IIdentityManagementService , you can try. I suspect _tfs is a valid representation of a TfsTeamProjectCollection
Miker
source share