次の方法で共有


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

ローカル コンピューターの登録情報を使用し、IIdentityManagementServiceで ID を偽装することによって TfsConfigurationServer オブジェクトの新しいインスタンスを初期化します。

名前空間:  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)