Udostępnij za pośrednictwem


SentShareInvitationsClient.CreateOrUpdate Method

Definition

Create/Update a sent share invitation in the given account.

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

Parameters

sentShareName
String

The name of the sent share.

sentShareInvitationName
String

Name of the sent invitation.

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, sentShareInvitationName or content is null.

sentShareName or sentShareInvitationName 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 SentShareInvitationsClient("<https://my-service.azure.com>", credential);

var data = new {
    invitationKind = "Application",
    properties = new {
        targetActiveDirectoryId = "<ApplicationInvitationPropertiesTargetActiveDirectoryId>",
        targetObjectId = "<ApplicationInvitationPropertiesTargetObjectId>",
    },
};

Response response = client.CreateOrUpdate("<sentShareName>", "<sentShareInvitationName>", 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 SentShareInvitationsClient("<https://my-service.azure.com>", credential);

var data = new {
    invitationKind = "Application",
    properties = new {
        expirationDate = "<2022-05-10T14:57:31.2311892-04:00>",
        shareKind = "<InPlace>",
        targetActiveDirectoryId = "<ApplicationInvitationPropertiesTargetActiveDirectoryId>",
        targetObjectId = "<ApplicationInvitationPropertiesTargetObjectId>",
    },
};

Response response = client.CreateOrUpdate("<sentShareName>", "<sentShareInvitationName>", 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("invitationKind").ToString());

Remarks

Create a sent share invitation

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

Request Body:

This method takes one of the JSON objects below as a payload. Please select a JSON object to view the schema for this.

ApplicationInvitationSchema for ApplicationInvitation:
{
              invitationKind: Application, # Required. The types of invitations.
              id: string, # Optional. The resource id of the resource.
              name: string, # Optional. Name of the resource.
              type: string, # Optional. Type of the resource.
              properties: {
                expirationDate: string (ISO 8601 Format), # Optional. The expiration date for the invitation
                invitationId: string, # Optional. Id of the invitation
                invitationStatus: "Pending" | "Accepted" | "Rejected", # Optional. Status of the invitation.
                provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
                respondedAt: string (ISO 8601 Format), # Optional. The time the recipient responded to the invitation.
                senderEmail: string, # Optional. Email address of the sender.
                senderName: string, # Optional. Name of the sender
                senderTenantName: string, # Optional. Tenant name of the sender
                sentAt: string (ISO 8601 Format), # Optional. Gets the time at which the invitation was sent.
                shareKind: "InPlace", # Optional. Defines the supported types for share.
                targetActiveDirectoryId: string, # Required. The target azure active directory id the invitation is sent to.
                targetObjectId: string, # Required. The target object id in the azure active directory the invitation is sent to.
              }, # Required. Properties of the application invitation type.
            }
~+ 1 more JSON objects
UserInvitationSchema for UserInvitation:
{
              invitationKind: User, # Required. The types of invitations.
              id: string, # Optional. The resource id of the resource.
              name: string, # Optional. Name of the resource.
              type: string, # Optional. Type of the resource.
              properties: {
                expirationDate: string (ISO 8601 Format), # Optional. The expiration date for the invitation
                invitationId: string, # Optional. Id of the invitation
                invitationStatus: "Pending" | "Accepted" | "Rejected", # Optional. Status of the invitation.
                provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
                respondedAt: string (ISO 8601 Format), # Optional. The time the recipient responded to the invitation.
                senderEmail: string, # Optional. Email address of the sender.
                senderName: string, # Optional. Name of the sender
                senderTenantName: string, # Optional. Tenant name of the sender
                sentAt: string (ISO 8601 Format), # Optional. Gets the time at which the invitation was sent.
                shareKind: "InPlace", # Optional. Defines the supported types for share.
                targetEmail: string, # Required. The receiver email for the invitation is being sent.
              }, # Required. Properties of the user invitation type.
            }

Response Body:

This method takes one of the JSON objects below as a payload. Please select a JSON object to view the schema for this.

ApplicationInvitationSchema for ApplicationInvitation:
{
              invitationKind: Application, # Required. The types of invitations.
              id: string, # Optional. The resource id of the resource.
              name: string, # Optional. Name of the resource.
              type: string, # Optional. Type of the resource.
              properties: {
                expirationDate: string (ISO 8601 Format), # Optional. The expiration date for the invitation
                invitationId: string, # Optional. Id of the invitation
                invitationStatus: "Pending" | "Accepted" | "Rejected", # Optional. Status of the invitation.
                provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
                respondedAt: string (ISO 8601 Format), # Optional. The time the recipient responded to the invitation.
                senderEmail: string, # Optional. Email address of the sender.
                senderName: string, # Optional. Name of the sender
                senderTenantName: string, # Optional. Tenant name of the sender
                sentAt: string (ISO 8601 Format), # Optional. Gets the time at which the invitation was sent.
                shareKind: "InPlace", # Optional. Defines the supported types for share.
                targetActiveDirectoryId: string, # Required. The target azure active directory id the invitation is sent to.
                targetObjectId: string, # Required. The target object id in the azure active directory the invitation is sent to.
              }, # Required. Properties of the application invitation type.
            }
~+ 1 more JSON objects
UserInvitationSchema for UserInvitation:
{
              invitationKind: User, # Required. The types of invitations.
              id: string, # Optional. The resource id of the resource.
              name: string, # Optional. Name of the resource.
              type: string, # Optional. Type of the resource.
              properties: {
                expirationDate: string (ISO 8601 Format), # Optional. The expiration date for the invitation
                invitationId: string, # Optional. Id of the invitation
                invitationStatus: "Pending" | "Accepted" | "Rejected", # Optional. Status of the invitation.
                provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
                respondedAt: string (ISO 8601 Format), # Optional. The time the recipient responded to the invitation.
                senderEmail: string, # Optional. Email address of the sender.
                senderName: string, # Optional. Name of the sender
                senderTenantName: string, # Optional. Tenant name of the sender
                sentAt: string (ISO 8601 Format), # Optional. Gets the time at which the invitation was sent.
                shareKind: "InPlace", # Optional. Defines the supported types for share.
                targetEmail: string, # Required. The receiver email for the invitation is being sent.
              }, # Required. Properties of the user invitation type.
            }

Applies to