![](/img/trans.png)
[英]How to use TFS REST API for making changes to work item as specified user
[英]Make Changes to a TFS Work Item as a specific user
我正在創建一個Web應用程序,團隊中的用戶將使用該Web應用程序來更改TFS工作項。 我為此使用TFS API。
為了訪問TFS服務器,我在Web應用程序中使用了我的憑據。
現在,每次有人使用該應用程序並對TFS工作項進行更改時,由於我的憑據已在應用程序中使用,因此這表明我對這些項進行了更改。
有沒有一種方法可以使用我登錄應用程序的人員的憑據在進行更改時在TFS上顯示?
您需要使用“代表他人發出請求”功能。 您可以通過以下方式模擬其他用戶:
public void Impersonation(Uri serverUri,string userToImpersonate)
{
// Read out the identity of the user we want to impersonate
TeamFoundationIdentity identity = ims.ReadIdentity(IdentitySearchFactor.AccountName,
userToImpersonate,
MembershipQuery.None,
ReadIdentityOptions.None);
tfs_impersonated = new TfsTeamProjectCollection(serverUri, identity.Descriptor);
GetAuthenticatedIdentity(tfs_impersonated);
// Use this tfs_impersonated object to communicate to TFS as the other users.
}
並確保您運行該網站的帳戶具有“代表他人提出請求”的權限:
http://www.codeproject.com/Articles/104019/TFS-API-Part-TFS-Impersonation
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.