Megosztás a következőn keresztül:


TfsConfigurationServer Constructor (RegisteredConfigurationServer, IdentityDescriptor)

Initializes a new instance of the TfsConfigurationServer object by using the registration information on the local computer, and impersonating an identity from IIdentityManagementService.

Namespace:  Microsoft.TeamFoundation.Client
Assembly:  Microsoft.TeamFoundation.Client (in Microsoft.TeamFoundation.Client.dll)

Syntax

'Declaration
Public Sub New ( _
    application As RegisteredConfigurationServer, _
    identityToImpersonate As IdentityDescriptor _
)
public TfsConfigurationServer(
    RegisteredConfigurationServer application,
    IdentityDescriptor identityToImpersonate
)
public:
TfsConfigurationServer(
    RegisteredConfigurationServer^ application, 
    IdentityDescriptor^ identityToImpersonate
)
new : 
        application:RegisteredConfigurationServer * 
        identityToImpersonate:IdentityDescriptor -> TfsConfigurationServer
public function TfsConfigurationServer(
    application : RegisteredConfigurationServer, 
    identityToImpersonate : IdentityDescriptor
)

Parameters

Remarks

You can get the registered configuration servers by using RegisteredTfsConnections.GetConfigurationServers.

To run code that uses this constructor, the process must have the "Make requests on behalf of others" permission. For more information about impersonation, see Connect to Team Foundation Server from a Console Application.

// Get the servers registered on this computer
RegisteredConfigurationServer[] servers = RegisteredTfsConnections.GetConfigurationServers();

// Connect to the first one in the array without impersonation
TfsConfigurationServer baseUserConnection = new TfsConfigurationServer(servers[0]);

// Get the identity management service
IIdentityManagementService ims = baseUserConnection.GetService<IIdentityManagementService>();

// Get the identity to impersonate
TeamFoundationIdentity identity = ims.ReadIdentity(IdentitySearchFactor.AccountName, @"DOMAIN\user",
   MembershipQuery.None, ReadIdentityOptions.None); 

// Connect using the impersonated identity
TfsConfigurationServer impersonatedConnection = new TfsConfigurationServer(servers[0], 
   identity.Descriptor);

.NET Framework Security

See Also

Reference

TfsConfigurationServer Class

TfsConfigurationServer Overload

Microsoft.TeamFoundation.Client Namespace

Other Resources

Connect to Team Foundation Server from a Console Application

Acting on Behalf of Another User (Impersonation)