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
Идентификатор для олицетворения.
Заметки
Зарегистрированные серверы конфигурации можно получить с помощью 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
- Полное доверие для непосредственно вызывающего метода. Этот член не может быть использован частично доверенным кодом. Дополнительные сведения см. в разделе Использование библиотек из не вполне надежного кода.
См. также
Ссылки
TfsConfigurationServer - перегрузка
Microsoft.TeamFoundation.Client - пространство имен
Другие ресурсы
Подключение к серверу Team Foundation Server из консольного приложения