Partager via


SentSharesClient.CreateSentShareInvitationAsync Méthode

Définition

[Méthode de protocole] Créez une invitation de partage envoyée.

  • Cette méthode de protocole permet la création explicite de la demande et le traitement de la réponse pour les scénarios avancés.
public virtual System.Threading.Tasks.Task<Azure.Response> CreateSentShareInvitationAsync (string sentShareId, string sentShareInvitationId, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateSentShareInvitationAsync : string * string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.CreateSentShareInvitationAsync : string * string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function CreateSentShareInvitationAsync (sentShareId As String, sentShareInvitationId As String, content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)

Paramètres

sentShareId
String

ID du partage envoyé.

sentShareInvitationId
String

ID de l’invitation de partage envoyée.

content
RequestContent

Contenu à envoyer en tant que corps de la demande.

context
RequestContext

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

Retours

Réponse retournée par le service.

Exceptions

sentShareId, sentShareInvitationId ou content a la valeur Null.

sentShareId ou sentShareInvitationId 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 CreateSentShareInvitationAsync avec les paramètres requis et le contenu de requête, et comment analyser le résultat.

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

var data = new {
    properties = new {
        targetActiveDirectoryId = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a",
        targetObjectId = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a",
    },
    invitationKind = "Service",
};

Response response = await client.CreateSentShareInvitationAsync("<sentShareId>", "<sentShareInvitationId>", RequestContent.Create(data));

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

Cet exemple montre comment appeler CreateSentShareInvitationAsync avec tous les paramètres et le contenu de requête, et comment analyser le résultat.

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

var data = new {
    properties = new {
        expirationDate = "2022-05-10T18:57:31.2311892Z",
        shareStatus = "Detached",
        targetActiveDirectoryId = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a",
        targetObjectId = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a",
    },
    invitationKind = "Service",
};

Response response = await client.CreateSentShareInvitationAsync("<sentShareId>", "<sentShareInvitationId>", RequestContent.Create(data));

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("invitationKind").ToString());
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("type").ToString());

Remarques

Créer un destinataire pour un partage envoyé donné

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.

ServiceInvitationSchéma pour ServiceInvitation:
{
  properties: {
    expirationDate: string (ISO 8601 Format), # Optional. The time at which the invitation will expire. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    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. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    shareStatus: "Detached" | "Attached", # Optional. Share status.
    state: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed", # Optional. State of the resource
    targetActiveDirectoryId: Guid, # Required. The target azure active directory id the invitation is sent to.
    targetObjectId: Guid, # Required. The target object id in the azure active directory the invitation is sent to.
  }, # Required. Properties of the service invitation type.
  invitationKind: Service, # Required. The types of invitations.
  id: string, # Optional. The unique id of the resource.
  type: string, # Optional. Type of the resource.
}
~+ 1 autres objets
JSONUserInvitationSchéma pour UserInvitation:
{
  properties: {
    expirationDate: string (ISO 8601 Format), # Optional. The time at which the invitation will expire. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    notify: boolean, # Optional. Whether or not the recipient was notified via email.
    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. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    shareStatus: "Detached" | "Attached", # Optional. Share status.
    state: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed", # Optional. State of the resource
    targetEmail: string, # Required. The receiver email for the invitation is being sent.
  }, # Required. Properties of the user invitation type.
  invitationKind: User, # Required. The types of invitations.
  id: string, # Optional. The unique id of the resource.
  type: string, # Optional. Type of the resource.
}

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.

ServiceInvitationSchéma pour ServiceInvitation:
{
  properties: {
    expirationDate: string (ISO 8601 Format), # Optional. The time at which the invitation will expire. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    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. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    shareStatus: "Detached" | "Attached", # Optional. Share status.
    state: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed", # Optional. State of the resource
    targetActiveDirectoryId: Guid, # Required. The target azure active directory id the invitation is sent to.
    targetObjectId: Guid, # Required. The target object id in the azure active directory the invitation is sent to.
  }, # Required. Properties of the service invitation type.
  invitationKind: Service, # Required. The types of invitations.
  id: string, # Optional. The unique id of the resource.
  type: string, # Optional. Type of the resource.
}
~+ 1 autres objets
JSONUserInvitationSchéma pour UserInvitation:
{
  properties: {
    expirationDate: string (ISO 8601 Format), # Optional. The time at which the invitation will expire. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    notify: boolean, # Optional. Whether or not the recipient was notified via email.
    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. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    shareStatus: "Detached" | "Attached", # Optional. Share status.
    state: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed", # Optional. State of the resource
    targetEmail: string, # Required. The receiver email for the invitation is being sent.
  }, # Required. Properties of the user invitation type.
  invitationKind: User, # Required. The types of invitations.
  id: string, # Optional. The unique id of the resource.
  type: string, # Optional. Type of the resource.
}

S’applique à