共用方式為


ReceivedInvitationsClient.RejectAsync Method

Definition

Rejects the received invitation identified by name.

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

Parameters

receivedInvitationName
String

Name of the received 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.

repeatabilityRequestId
String

If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated, globally unique for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs.

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

receivedInvitationName or content is null.

receivedInvitationName 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 RejectAsync with required parameters and request content, and how to parse the result.

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

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

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

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

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

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

var data = new {
    invitationKind = "Application",
    properties = new {
        shareKind = "<InPlace>",
        targetActiveDirectoryId = "<ApplicationReceivedInvitationPropertiesTargetActiveDirectoryId>",
        targetObjectId = "<ApplicationReceivedInvitationPropertiesTargetObjectId>",
    },
};

Response response = await client.RejectAsync("<receivedInvitationName>", RequestContent.Create(data), "<repeatabilityRequestId>");

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

Reject a received 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.

ApplicationReceivedInvitationSchema for ApplicationReceivedInvitation:
{
              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: {
                description: string, # Optional. Description shared when the invitation was created
                expirationDate: string (ISO 8601 Format), # Optional. The expiration date for the received share created by accepting the invitation.
                invitationStatus: "Pending" | "Accepted" | "Rejected", # Optional. Status of the invitation.
                location: string, # Optional. Location of the invitation.
                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
                respondedAt: string (ISO 8601 Format), # Optional. The time the recipient responded to the 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
                sentAt: string (ISO 8601 Format), # Optional. Gets the time at which the invitation was sent.
                sentShareName: string, # Optional. Gets the source share Name.
                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 for a received invitation of kind application.
            }
~+ 1 more JSON objects
UserReceivedInvitationSchema for UserReceivedInvitation:
{
              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: {
                description: string, # Optional. Description shared when the invitation was created
                expirationDate: string (ISO 8601 Format), # Optional. The expiration date for the received share created by accepting the invitation.
                invitationStatus: "Pending" | "Accepted" | "Rejected", # Optional. Status of the invitation.
                location: string, # Optional. Location of the invitation.
                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
                respondedAt: string (ISO 8601 Format), # Optional. The time the recipient responded to the 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
                sentAt: string (ISO 8601 Format), # Optional. Gets the time at which the invitation was sent.
                sentShareName: string, # Optional. Gets the source share Name.
                shareKind: "InPlace", # Optional. Defines the supported types for share.
                targetEmail: string, # Required. The receiver email for the invitation is being sent.
              }, # Required. Properties for a received invitation of kind user.
            }

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.

ApplicationReceivedInvitationSchema for ApplicationReceivedInvitation:
{
              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: {
                description: string, # Optional. Description shared when the invitation was created
                expirationDate: string (ISO 8601 Format), # Optional. The expiration date for the received share created by accepting the invitation.
                invitationStatus: "Pending" | "Accepted" | "Rejected", # Optional. Status of the invitation.
                location: string, # Optional. Location of the invitation.
                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
                respondedAt: string (ISO 8601 Format), # Optional. The time the recipient responded to the 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
                sentAt: string (ISO 8601 Format), # Optional. Gets the time at which the invitation was sent.
                sentShareName: string, # Optional. Gets the source share Name.
                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 for a received invitation of kind application.
            }
~+ 1 more JSON objects
UserReceivedInvitationSchema for UserReceivedInvitation:
{
              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: {
                description: string, # Optional. Description shared when the invitation was created
                expirationDate: string (ISO 8601 Format), # Optional. The expiration date for the received share created by accepting the invitation.
                invitationStatus: "Pending" | "Accepted" | "Rejected", # Optional. Status of the invitation.
                location: string, # Optional. Location of the invitation.
                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
                respondedAt: string (ISO 8601 Format), # Optional. The time the recipient responded to the 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
                sentAt: string (ISO 8601 Format), # Optional. Gets the time at which the invitation was sent.
                sentShareName: string, # Optional. Gets the source share Name.
                shareKind: "InPlace", # Optional. Defines the supported types for share.
                targetEmail: string, # Required. The receiver email for the invitation is being sent.
              }, # Required. Properties for a received invitation of kind user.
            }

Applies to