SentSharesClient.CreateOrUpdateAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Create a sent share in the given Purview account.
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)
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 CreateOrUpdateAsync 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 = await client.CreateOrUpdateAsync("<sentShareName>", RequestContent.Create(data));
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());
This sample shows how to call CreateOrUpdateAsync 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 = 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());
Remarks
Create a sent share
Below is the JSON schema for the request and response payloads.
Request Body:
InPlaceSentShare
Schema forInPlaceSentShare
:
{
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:
InPlaceSentShare
Schema forInPlaceSentShare
:
{
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.
}