Udostępnij za pośrednictwem


Konstruktor TfsConfigurationServer — (Uri, IdentityDescriptor)

Inicjuje nowe wystąpienie obiektu TfsConfigurationServer.

Przestrzeń nazw:  Microsoft.TeamFoundation.Client
Zestaw:  Microsoft.TeamFoundation.Client (w Microsoft.TeamFoundation.Client.dll)

Składnia

'Deklaracja
Public Sub New ( _
    uri As Uri, _
    identityToImpersonate As IdentityDescriptor _
)
public TfsConfigurationServer(
    Uri uri,
    IdentityDescriptor identityToImpersonate
)

Parametry

  • uri
    Typ: System.Uri
    Universal resource identifier (URI) serwera z systemem Team Foundation Server.

Wyjątki

Wyjątek Warunek
ArgumentNullException

gdy uri jest zerowy

Uwagi

Aby uruchomić kod, który używa tego konstruktora, proces musi mieć uprawnienie "Make żądań w imieniu innych".Aby uzyskać więcej informacji o personifikacji, zobacz Acting on Behalf of Another User (Impersonation).

// Connect to Team Foundation Server
//     server is the name of the server that is running the Team Foundation application-tier. 
//     port is the port that Team Foundation uses. The default port is 8080. 
//     vdir is the virtual path to the Team Foundation application. The default path is tfs. 
Uri tfsUri = (args.Length < 1) ? 
new Uri("http://server:port/vdir") : new Uri(args[0]); 

// Connect to the server without impersonation
TfsConfigurationServer baseUserConnection = new TfsConfigurationServer(tfsUri);

// 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(tfsuri, 
   identity.Descriptor);

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

TfsConfigurationServer Klasa

Przeciążenie TfsConfigurationServer

Przestrzeń nazw Microsoft.TeamFoundation.Client

Inne zasoby

Połączyć się z aplikacji konsoli Team Foundation Server

Acting on Behalf of Another User (Impersonation)