TfsConfigurationServer コンストラクター (Uri, IdentityDescriptor)

TfsConfigurationServer のオブジェクトの新しいインスタンスを初期化します。

名前空間:  Microsoft.TeamFoundation.Client
アセンブリ:  Microsoft.TeamFoundation.Client (Microsoft.TeamFoundation.Client.dll 内)

構文

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

パラメーター

  • uri
    型 : System.Uri
    Team Foundation Serverを実行しているサーバーの汎用リソース識別子 (URI)。

例外

例外 条件
ArgumentNullException

uri が null のとき

解説

このコンストラクターを使用するコードを実行するには、プロセスは 「そのほかの代わりに」アクセス許可を要求することが必要です。偽装に関する詳細については、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);

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

TfsConfigurationServer クラス

TfsConfigurationServer オーバーロード

Microsoft.TeamFoundation.Client 名前空間

その他の技術情報

コンソール アプリケーションからの Team Foundation Server への接続

Acting on Behalf of Another User (Impersonation)