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
)
參數
- application
型別:Microsoft.TeamFoundation.Client.RegisteredConfigurationServer
執行 Team Foundation Server的註冊的伺服器。
- identityToImpersonate
型別:Microsoft.TeamFoundation.Framework.Client.IdentityDescriptor
模擬的識別 (Identity)。
備註
您可以使用 RegisteredTfsConnections.GetConfigurationServers,您可以從註冊的設定伺服器。
若要使用這個建構函式的程式碼,這個處理序必須具有「代表其他人提出要求」權限。 如需模擬的詳細資訊,請參閱 Acting on Behalf of Another User (Impersonation)。
// 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 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.TeamFoundation.Client 命名空間