Make Changes to a TFS Work Item as a specific user

前端 未结 1 613
旧时难觅i
旧时难觅i 2021-01-21 17:16

I am working on creating a Web application, which the users in my team will use to make changes to TFS Work Items. I am using TFS API for this..

In order to access

相关标签:
1条回答
  • 2021-01-21 18:05

    You need to use the 'make requests on behalf of others' functionality. You can impersonate another user by following:

    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.
    }
    

    And make sure your account running the website has the permission to "make requests on behalf of others":

    enter image description here http://www.codeproject.com/Articles/104019/TFS-API-Part-TFS-Impersonation

    0 讨论(0)
提交回复
热议问题