共用方式為


EmailRegistrationClient.Activate Method

Definition

Activates the tenant and email combination using the activation code received.

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

Parameters

content
RequestContent

The content to send as the body of the request. Details of the request body schema are in the Remarks section below.

repeatabilityRequestId
String

If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated, globally unique for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service. Details of the response body schema are in the Remarks section below.

Exceptions

content is null.

Service returned a non-success status code.

Examples

This sample shows how to call Activate with required parameters and parse the result.

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());

This sample shows how to call Activate with all parameters and request content, and how to parse the result.

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());

Remarks

Activates the email registration for current tenant

Below is the JSON schema for the request and response payloads.

Request Body:

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

Response Body:

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

Applies to