共用方式為


TfsConfigurationServer 建構函式 (RegisteredConfigurationServer, IdentityDescriptor)

初始化 TfsConfigurationServer 物件的新執行個體以用於本機電腦和模擬的識別的登入資訊從 IIdentityManagementService

命名空間:  Microsoft.TeamFoundation.Client
組件:  Microsoft.TeamFoundation.Client (在 Microsoft.TeamFoundation.Client.dll 中)

語法

'宣告
Public Sub New ( _
    application As RegisteredConfigurationServer, _
    identityToImpersonate As IdentityDescriptor _
)
public TfsConfigurationServer(
    RegisteredConfigurationServer application,
    IdentityDescriptor identityToImpersonate
)

參數

備註

使用 RegisteredTfsConnections.GetConfigurationServers,您可以取得登錄伺服器的組態。

若要使用這個建構函式的程式碼,處理序必須具有「代表其他要求權限。 如需模擬的詳細資訊,請參閱 從主控台應用程式連接到 Team Foundation Server

// 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 安全性

請參閱

參考

TfsConfigurationServer 類別

TfsConfigurationServer 多載

Microsoft.TeamFoundation.Client 命名空間

其他資源

從主控台應用程式連接到 Team Foundation Server

Acting on Behalf of Another User (Impersonation)