次の方法で共有


EmailRegistrationClient.Activate メソッド

定義

受信したアクティブ化コードを使用して、テナントとメールの組み合わせをアクティブ化します。

public virtual Azure.Response Activate (Azure.Core.RequestContent content, string repeatabilityRequestId = default, Azure.RequestContext context = default);
abstract member Activate : Azure.Core.RequestContent * string * Azure.RequestContext -> Azure.Response
override this.Activate : Azure.Core.RequestContent * string * Azure.RequestContext -> Azure.Response
Public Overridable Function Activate (content As RequestContent, Optional repeatabilityRequestId As String = Nothing, Optional context As RequestContext = Nothing) As Response

パラメーター

content
RequestContent

要求の本文として送信するコンテンツ。 要求本文スキーマの詳細については、以下の「解説」セクションを参照してください。

repeatabilityRequestId
String

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

context
RequestContext

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

戻り値

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

例外

content が null です。

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

このサンプルでは、必要なパラメーターを指定して Activate を呼び出し、結果を解析する方法を示します。

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

var data = new {};

Response response = client.Activate(RequestContent.Create(data));

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

このサンプルでは、すべてのパラメーターと要求コンテンツを使用して Activate を呼び出す方法と、結果を解析する方法を示します。

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

var data = new {
    properties = new {
        activationCode = "<TenantEmailRegistrationPropertiesActivationCode>",
    },
};

Response response = client.Activate(RequestContent.Create(data), "<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.
            }

応答本文:

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.
            }

適用対象