Partager via


SentSharesClient.CreateOrUpdate Méthode

Définition

Créez un partage envoyé dans le compte Purview donné.

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

Paramètres

sentShareName
String

Nom du partage envoyé.

content
RequestContent

Contenu à envoyer en tant que corps de la demande. Les détails du schéma du corps de la demande se trouvent dans la section Remarques ci-dessous.

context
RequestContext

Contexte de requête, qui peut remplacer les comportements par défaut du pipeline client par appel.

Retours

Réponse retournée par le service. Les détails du schéma du corps de la réponse se trouvent dans la section Remarques ci-dessous.

Exceptions

sentShareName ou content est null.

sentShareName est une chaîne vide, et on s’attendait à ce qu’elle ne soit pas vide.

Le service a retourné un code de status non réussi.

Exemples

Cet exemple montre comment appeler CreateOrUpdate avec les paramètres requis et demander le contenu, et comment analyser le résultat.

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 = client.CreateOrUpdate("<sentShareName>", RequestContent.Create(data));

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

Cet exemple montre comment appeler CreateOrUpdate avec tous les paramètres et le contenu de la demande, et comment analyser le résultat.

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 = client.CreateOrUpdate("<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());

Remarques

Créer un partage envoyé

Vous trouverez ci-dessous le schéma JSON pour les charges utiles de demande et de réponse.

Corps de la demande :

InPlaceSentShare Schéma pour 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.
            }

Corps de réponse :

InPlaceSentShare Schéma pour 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.
            }

S’applique à