![](/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.