2013-01-24 63 views
8

我試圖從Excel中添加TFS API運行的測試。
在Excel中的一個領域,我得到了執行測試的用戶。
我想以更新它來更新它的服務器,我需要得到用戶的TeamFoundationIdentityTFS按名稱獲取用戶

ims = _tfs.GetService<IIdentityManagementService>(); 
TeamFoundationIdentity UserID = ims.ReadIdentity(IdentitySearchFactor.DisplayName, 
    userName, ReadIdentityOptions.None); 

請幫我解決這個問題。

回答

4

您正在使用哪個版本的Visual Studio和TFS? 我使用TFS2010和VS2010和下面的代碼工作對我罰款:

如果
IIdentityManagementService ims = (IIdentityManagementService)_tfs.GetService(typeof(IIdentityManagementService)); 
TeamFoundationIdentity UserID = ims.ReadIdentity(IdentitySearchFactor.DisplayName,"Mike" , MembershipQuery.Direct, ReadIdentityOptions.None); 

不知道這個問題是IIdentityManagementService只是initialistation,你可以試試看。我懷疑_tfsTfsTeamProjectCollection的有效表示

+0

我知道這是一箇舊帖子。哪些名稱空間可以在IIdentityManagementService和TeamFoundationIdentity中找到?有我需要的SDK嗎? –

+0

我不能使用我使用它的工具,可能不再存在。我搜索了網絡,這應該是正確的: https://msdn.microsoft.com/de-de/library/microsoft.teamfoundation.server.core.teamfoundationidentity.aspx – MikeR