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)