SentSharesClient.CreateOrUpdate Method

Definition

Create a sent share in the given Purview account.

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

Parameters

sentShareName
String

The name of the sent share.

content
RequestContent

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

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

sentShareName or content is null.

sentShareName is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

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

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

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

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

Remarks

Create a sent share

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

Request Body:

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

Response Body:

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

Applies to