次の方法で共有


ReceivedSharesClient.CreateAsync メソッド

定義

特定のアカウントに受信した共有を作成します。

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

パラメーター

receivedShareName
String

受信した共有の名前。

content
RequestContent

要求の本文として送信するコンテンツ。 要求本文スキーマの詳細については、以下の「解説」セクションを参照してください。

context
RequestContext

要求コンテキスト。これは、呼び出しごとにクライアント パイプラインの既定の動作をオーバーライドできます。

戻り値

サービスから返された応答。 応答本文スキーマの詳細については、以下の「解説」セクションを参照してください。

例外

receivedShareName または content が null です。

receivedShareName は空の文字列であり、空でないと想定されていました。

サービスから成功以外の状態コードが返されました。

このサンプルでは、必要なパラメーターと要求コンテンツを使用して CreateAsync を呼び出す方法と、結果を解析する方法を示します。

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

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

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

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

このサンプルでは、すべてのパラメーターと要求コンテンツを使用して CreateAsync を呼び出す方法と、結果を解析する方法を示します。

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

var data = new {
    shareKind = "InPlace",
    properties = new {
        collection = new {
            referenceName = "<CollectionReferenceName>",
            type = "<CollectionType>",
        },
        expirationDate = "<2022-05-10T14:57:31.2311892-04:00>",
        invitationId = "<InPlaceReceivedSharePropertiesInvitationId>",
        sentShareDescription = "<InPlaceReceivedSharePropertiesSentShareDescription>",
        sentShareLocation = "<InPlaceReceivedSharePropertiesSentShareLocation>",
    },
};

Response response = await client.CreateAsync("<receivedShareName>", 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());

注釈

受信した共有を作成する

要求と応答のペイロードの JSON スキーマを次に示します。

要求本文:

InPlaceReceivedShareInPlaceReceivedShareスキーマ:
{
              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 received share was created.
                expirationDate: string (ISO 8601 Format), # Optional. The expiration date of the received share.
                invitationId: string, # Required. The invitation id.
                provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
                receivedShareStatus: "Active" | "Reinstating" | "Revoked" | "Revoking" | "RevokeFailed" | "ReinstateFailed" | "SourceDeleted", # Optional. received share status
                receiverEmail: string, # Optional. Email of the user/receiver who received the sent share invitation
                receiverName: string, # Optional. Name of the user/receiver who received the sent share invitation
                receiverTenantName: string, # Optional. Tenant name of the user/receiver who received the sent share invitation
                senderEmail: string, # Optional. Email of the sender who created the sent share invitation
                senderName: string, # Optional. Name of the sender who created the sent share invitation
                senderTenantName: string, # Optional. Tenant name of the sender who created the sent share invitation
                sentShareDescription: string, # Optional. Share description.
                sentShareLocation: string, # Required. Sent share location.
                sharedAt: string (ISO 8601 Format), # Optional. Time at which the sent share was shared.
                shareName: string, # Optional. Name of the share
              }, # Required. Properties of in place received share.
            }

応答本文:

InPlaceReceivedShareInPlaceReceivedShareスキーマ:
{
              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 received share was created.
                expirationDate: string (ISO 8601 Format), # Optional. The expiration date of the received share.
                invitationId: string, # Required. The invitation id.
                provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
                receivedShareStatus: "Active" | "Reinstating" | "Revoked" | "Revoking" | "RevokeFailed" | "ReinstateFailed" | "SourceDeleted", # Optional. received share status
                receiverEmail: string, # Optional. Email of the user/receiver who received the sent share invitation
                receiverName: string, # Optional. Name of the user/receiver who received the sent share invitation
                receiverTenantName: string, # Optional. Tenant name of the user/receiver who received the sent share invitation
                senderEmail: string, # Optional. Email of the sender who created the sent share invitation
                senderName: string, # Optional. Name of the sender who created the sent share invitation
                senderTenantName: string, # Optional. Tenant name of the sender who created the sent share invitation
                sentShareDescription: string, # Optional. Share description.
                sentShareLocation: string, # Required. Sent share location.
                sharedAt: string (ISO 8601 Format), # Optional. Time at which the sent share was shared.
                shareName: string, # Optional. Name of the share
              }, # Required. Properties of in place received share.
            }

適用対象