Partager via


SentShareInvitationsClient.CreateOrUpdateAsync Méthode

Définition

Créer/mettre à jour une invitation de partage envoyée dans le compte donné.

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

Paramètres

sentShareName
String

Nom du partage envoyé.

sentShareInvitationName
String

Nom de l’invitation envoyée.

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.

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

sentShareName, sentShareInvitationName ou content a la valeur Null.

sentShareName ou sentShareInvitationName 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 CreateOrUpdateAsync avec les paramètres requis et demander le contenu, et comment analyser le résultat.

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 = await client.CreateOrUpdateAsync("<sentShareName>", "<sentShareInvitationName>", RequestContent.Create(data));

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

Cet exemple montre comment appeler CreateOrUpdateAsync avec tous les paramètres et demander le contenu, et comment analyser le résultat.

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 = await client.CreateOrUpdateAsync("<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());

Remarques

Créer une invitation de partage envoyé

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.

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

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.

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

S’applique à