次の方法で共有


EmailRegistrationClient.RegisterAsync(String, RequestContext) メソッド

定義

アクティブ化のためにテナントと電子メールの組み合わせを登録します。

public virtual System.Threading.Tasks.Task<Azure.Response> RegisterAsync (string repeatabilityRequestId = default, Azure.RequestContext context = default);
abstract member RegisterAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.RegisterAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function RegisterAsync (Optional repeatabilityRequestId As String = Nothing, Optional context As RequestContext = Nothing) As Task(Of Response)

パラメーター

repeatabilityRequestId
String

指定した場合、クライアントは要求が繰り返し可能であることを指示します。つまり、クライアントは同じ Repeatability-Request-Id を使用して要求を複数回行い、サーバーが要求を複数回実行せずに適切な応答を返すことができます。 Repeatability-Request-Id の値は、クライアントによって生成され、常にグローバルに一意である要求の識別子を表す不透明な文字列です。 バージョン 4 (ランダム) UUID を使用することをお勧めします。

context
RequestContext

要求コンテキスト。これは、クライアント パイプラインの既定の動作を呼び出しごとにオーバーライドできます。

戻り値

サービスから返された応答。 応答本文スキーマの詳細については、以下の「解説」セクションを参照してください。

例外

サービスから成功以外の状態コードが返されました。

このサンプルでは、RegisterAsync を呼び出して結果を解析する方法を示します。

var credential = new DefaultAzureCredential();
var client = new EmailRegistrationClient("<https://my-service.azure.com>", credential);

Response response = await client.RegisterAsync();

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());

このサンプルでは、すべてのパラメーターで RegisterAsync を呼び出す方法と、結果を解析する方法を示します。

var credential = new DefaultAzureCredential();
var client = new EmailRegistrationClient("<https://my-service.azure.com>", credential);

Response response = await client.RegisterAsync("<repeatabilityRequestId>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("properties").GetProperty("activationCode").ToString());
Console.WriteLine(result.GetProperty("properties").GetProperty("activationExpiration").ToString());
Console.WriteLine(result.GetProperty("properties").GetProperty("email").ToString());
Console.WriteLine(result.GetProperty("properties").GetProperty("registrationStatus").ToString());
Console.WriteLine(result.GetProperty("properties").GetProperty("tenantId").ToString());

注釈

現在のテナントの電子メールを登録する

応答ペイロードの JSON スキーマを次に示します。

応答本文:

TenantEmailRegistrationスキーマ:

{
              id: string, # Optional. The resource id of the resource.
              name: string, # Optional. Name of the resource.
              type: string, # Optional. Type of the resource.
              properties: {
                activationCode: string, # Required. Activation code for the registration.
                activationExpiration: string (ISO 8601 Format), # Optional. Date of the activation expiration.
                email: string, # Optional. The email to register.
                registrationStatus: "ActivationPending" | "Activated" | "ActivationAttemptsExhausted", # Optional. Defines the supported types for registration.
                tenantId: string, # Optional. The tenant id to register.
              }, # Optional. Tenant email registration property bag.
            }

適用対象