Compartir a través de


SentSharesClient.CreateOrUpdateAsync Método

Definición

Cree un recurso compartido enviado en la cuenta de Purview especificada.

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

Parámetros

sentShareName
String

Nombre del recurso compartido enviado.

content
RequestContent

Contenido que se va a enviar como el cuerpo de la solicitud. Los detalles del esquema del cuerpo de la solicitud se encuentran en la sección Comentarios a continuación.

context
RequestContext

Contexto de solicitud, que puede invalidar los comportamientos predeterminados de la canalización de cliente por llamada.

Devoluciones

Respuesta devuelta por el servicio. Los detalles del esquema del cuerpo de la respuesta se encuentran en la sección Comentarios siguiente.

Excepciones

sentShareName o content es null.

sentShareName es una cadena vacía y se esperaba que no estuviera vacía.

El servicio devolvió un código de estado no correcto.

Ejemplos

En este ejemplo se muestra cómo llamar a CreateOrUpdateAsync con los parámetros necesarios y el contenido de la solicitud, y cómo analizar el resultado.

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

var data = new {
    shareKind = "InPlace",
    properties = new {
        collection = new {
            referenceName = "<CollectionReferenceName>",
            type = "<CollectionType>",
        },
    },
};

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

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

En este ejemplo se muestra cómo llamar a CreateOrUpdateAsync con todos los parámetros y solicitar contenido y cómo analizar el resultado.

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

var data = new {
    shareKind = "InPlace",
    properties = new {
        collection = new {
            referenceName = "<CollectionReferenceName>",
            type = "<CollectionType>",
        },
        description = "<InPlaceSentSharePropertiesDescription>",
    },
};

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

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("shareKind").ToString());

Comentarios

Creación de un recurso compartido enviado

A continuación se muestra el esquema JSON para las cargas de solicitud y respuesta.

Cuerpo de la solicitud:

InPlaceSentShare Esquema para InPlaceSentShare:
{
              shareKind: InPlace, # Required. Defines the supported types for share.
              id: string, # Optional. The resource id of the resource.
              name: string, # Optional. Name of the resource.
              type: string, # Optional. Type of the resource.
              properties: {
                collection: {
                  referenceName: string, # Required. Gets or sets the reference name.
                  type: string, # Required. Gets or sets the reference type property.
                }, # Required. Reference to a Collection.
                createdAt: string (ISO 8601 Format), # Optional. Time at which the share was created.
                description: string, # Optional. Share description.
                provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
                senderEmail: string, # Optional. Email of the sender who created the sent share.
                senderName: string, # Optional. Name of the sender who created the sent share.
                senderTenantName: string, # Optional. Tenant name of the sender who created the sent share.
              }, # Required. Properties of in place sent share.
            }

Cuerpo de la respuesta:

InPlaceSentShare Esquema para InPlaceSentShare:
{
              shareKind: InPlace, # Required. Defines the supported types for share.
              id: string, # Optional. The resource id of the resource.
              name: string, # Optional. Name of the resource.
              type: string, # Optional. Type of the resource.
              properties: {
                collection: {
                  referenceName: string, # Required. Gets or sets the reference name.
                  type: string, # Required. Gets or sets the reference type property.
                }, # Required. Reference to a Collection.
                createdAt: string (ISO 8601 Format), # Optional. Time at which the share was created.
                description: string, # Optional. Share description.
                provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
                senderEmail: string, # Optional. Email of the sender who created the sent share.
                senderName: string, # Optional. Name of the sender who created the sent share.
                senderTenantName: string, # Optional. Tenant name of the sender who created the sent share.
              }, # Required. Properties of in place sent share.
            }

Se aplica a