Compartilhar via


ReceivedSharesClient.ActivateTenantEmailRegistrationAsync Método

Definição

[Método protocol] Ativa a combinação de locatário e email usando o código de ativação recebido.

  • Esse método de protocolo permite a criação explícita da solicitação e o processamento da resposta para cenários avançados.
public virtual System.Threading.Tasks.Task<Azure.Response> ActivateTenantEmailRegistrationAsync (Azure.Core.RequestContent content, string repeatabilityRequestId = default, Azure.RequestContext context = default);
abstract member ActivateTenantEmailRegistrationAsync : Azure.Core.RequestContent * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.ActivateTenantEmailRegistrationAsync : Azure.Core.RequestContent * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function ActivateTenantEmailRegistrationAsync (content As RequestContent, Optional repeatabilityRequestId As String = Nothing, Optional context As RequestContext = Nothing) As Task(Of Response)

Parâmetros

content
RequestContent

O conteúdo a ser enviado como o corpo da solicitação.

repeatabilityRequestId
String

Se especificado, o cliente direciona que a solicitação é repetível; ou seja, o cliente pode fazer a solicitação várias vezes com a mesma Repeatability-Request-Id e obter de volta uma resposta apropriada sem que o servidor execute a solicitação várias vezes. O valor do Repeatability-Request-Id é uma cadeia de caracteres opaca que representa um identificador gerado pelo cliente, globalmente exclusivo para todos os tempos, para a solicitação. É recomendável usar UUIDs da versão 4 (aleatória).

context
RequestContext

O contexto de solicitação, que pode substituir os comportamentos padrão do pipeline do cliente por chamada.

Retornos

A resposta retornada do serviço.

Exceções

content é nulo.

O serviço retornou um código de status sem êxito.

Exemplos

Este exemplo mostra como chamar ActivateTenantEmailRegistrationAsync com os parâmetros necessários e analisar o resultado.

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

var data = new {};

Response response = await client.ActivateTenantEmailRegistrationAsync(RequestContent.Create(data));

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

Este exemplo mostra como chamar ActivateTenantEmailRegistrationAsync com todos os parâmetros e conteúdo da solicitação e como analisar o resultado.

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

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

Response response = await client.ActivateTenantEmailRegistrationAsync(RequestContent.Create(data), "<repeatabilityRequestId>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
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("state").ToString());
Console.WriteLine(result.GetProperty("properties").GetProperty("tenantId").ToString());
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("type").ToString());

Comentários

Ativa o registro de email para o locatário atual

Abaixo está o esquema JSON para as cargas de solicitação e resposta.

Corpo da solicitação:

Esquema para TenantEmailRegistration:

{
  properties: {
    activationCode: string, # Required. Activation code for the registration.
    activationExpiration: string (ISO 8601 Format), # Optional. Date of the activation expiration. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    email: string, # Optional. The email to register.
    registrationStatus: "ActivationPending" | "Activated" | "ActivationAttemptsExhausted", # Optional. Defines the supported types for registration.
    state: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed", # Optional. State of the resource
    tenantId: string, # Optional. The tenant id to register.
  }, # Optional. Tenant email registration property bag.
  id: string, # Optional. The unique id of the resource.
  type: string, # Optional. Type of the resource.
}

Corpo da resposta:

Esquema para TenantEmailRegistration:

{
  properties: {
    activationCode: string, # Required. Activation code for the registration.
    activationExpiration: string (ISO 8601 Format), # Optional. Date of the activation expiration. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    email: string, # Optional. The email to register.
    registrationStatus: "ActivationPending" | "Activated" | "ActivationAttemptsExhausted", # Optional. Defines the supported types for registration.
    state: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed", # Optional. State of the resource
    tenantId: string, # Optional. The tenant id to register.
  }, # Optional. Tenant email registration property bag.
  id: string, # Optional. The unique id of the resource.
  type: string, # Optional. Type of the resource.
}

Aplica-se a