Partager via


ReceivedInvitationsClient.RejectAsync Méthode

Définition

Rejette l’invitation reçue identifiée par son nom.

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)

Paramètres

receivedInvitationName
String

Nom de l’invitation reçue.

content
RequestContent

Contenu à envoyer en tant que corps de la demande. Les détails du schéma du corps de la demande se trouvent dans la section Remarques ci-dessous.

repeatabilityRequestId
String

Si elle est spécifiée, le client indique que la demande est reproductible ; autrement dit, le client peut effectuer la demande plusieurs fois avec le même Repeatability-Request-ID et obtenir une réponse appropriée sans que le serveur n’exécute la demande plusieurs fois. La valeur de Repeatability-Request-ID est une chaîne opaque représentant un identificateur généré par le client, globalement unique pour tout le temps, pour la requête. Il est recommandé d’utiliser des UUID version 4 (aléatoires).

context
RequestContext

Contexte de requête, qui peut remplacer les comportements par défaut du pipeline client par appel.

Retours

Réponse retournée par le service. Les détails du schéma du corps de la réponse se trouvent dans la section Remarques ci-dessous.

Exceptions

receivedInvitationName ou content est null.

receivedInvitationName est une chaîne vide, et on s’attendait à ce qu’elle ne soit pas vide.

Le service a retourné un code de status non réussi.

Exemples

Cet exemple montre comment appeler RejectAsync avec les paramètres requis et le contenu de la demande, et comment analyser le résultat.

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

Cet exemple montre comment appeler RejectAsync avec tous les paramètres et le contenu de la demande, et comment analyser le résultat.

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

Remarques

Rejeter une invitation reçue

Vous trouverez ci-dessous le schéma JSON pour les charges utiles de demande et de réponse.

Corps de la demande :

Cette méthode prend l’un des objets JSON ci-dessous comme charge utile. Sélectionnez un objet JSON pour afficher le schéma correspondant.

ApplicationReceivedInvitation Schéma pour 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 autres objets
JSON UserReceivedInvitation Schéma pour 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.
            }

Corps de réponse :

Cette méthode prend l’un des objets JSON ci-dessous comme charge utile. Sélectionnez un objet JSON pour afficher le schéma correspondant.

ApplicationReceivedInvitation Schéma pour 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 autres objets
JSON UserReceivedInvitation Schéma pour 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.
            }

S’applique à