Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
Code 204 No Content de réponse pour les autorisations d’application.
Exemples
Exemple 1 : Création d’un enregistrement d’inscription avec une autorisation déléguée
Utilisez l’autorisation déléguée pour créer un enregistrement d’inscription pour une personne disposant d’un Microsoft Entra ID afin d’inscrire un utilisateur Microsoft Entra à un webinaire.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
using Microsoft.Kiota.Abstractions.Serialization;
var requestBody = new VirtualEventRegistration
{
PreferredTimezone = "Pacific Standard Time",
PreferredLanguage = "en-us",
RegistrationQuestionAnswers = new List<VirtualEventRegistrationQuestionAnswer>
{
new VirtualEventRegistrationQuestionAnswer
{
QuestionId = "95320781-96b3-4b8f-8cf8-e6561d23447a",
Value = null,
BooleanValue = null,
MultiChoiceValues = new List<string>
{
"Seattle",
},
},
new VirtualEventRegistrationQuestionAnswer
{
QuestionId = "4577afdb-8bee-4219-b482-04b52c6b855c",
Value = null,
BooleanValue = true,
MultiChoiceValues = new List<string>
{
},
},
new VirtualEventRegistrationQuestionAnswer
{
QuestionId = "80fefcf1-caf7-4cd3-b8d7-159e17c47f20",
Value = null,
BooleanValue = null,
MultiChoiceValues = new List<string>
{
"Cancun",
"Hoboken",
"Beijing",
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"externalRegistrationInformation" , new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"referrer", new UntypedString("Facebook")
},
{
"registrationId", new UntypedString("myExternalRegistrationId")
},
})
},
},
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Solutions.VirtualEvents.Webinars["{virtualEventWebinar-id}"].Registrations.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
VirtualEventRegistration virtualEventRegistration = new VirtualEventRegistration();
virtualEventRegistration.setPreferredTimezone("Pacific Standard Time");
virtualEventRegistration.setPreferredLanguage("en-us");
LinkedList<VirtualEventRegistrationQuestionAnswer> registrationQuestionAnswers = new LinkedList<VirtualEventRegistrationQuestionAnswer>();
VirtualEventRegistrationQuestionAnswer virtualEventRegistrationQuestionAnswer = new VirtualEventRegistrationQuestionAnswer();
virtualEventRegistrationQuestionAnswer.setQuestionId("95320781-96b3-4b8f-8cf8-e6561d23447a");
virtualEventRegistrationQuestionAnswer.setValue(null);
virtualEventRegistrationQuestionAnswer.setBooleanValue(null);
LinkedList<String> multiChoiceValues = new LinkedList<String>();
multiChoiceValues.add("Seattle");
virtualEventRegistrationQuestionAnswer.setMultiChoiceValues(multiChoiceValues);
registrationQuestionAnswers.add(virtualEventRegistrationQuestionAnswer);
VirtualEventRegistrationQuestionAnswer virtualEventRegistrationQuestionAnswer1 = new VirtualEventRegistrationQuestionAnswer();
virtualEventRegistrationQuestionAnswer1.setQuestionId("4577afdb-8bee-4219-b482-04b52c6b855c");
virtualEventRegistrationQuestionAnswer1.setValue(null);
virtualEventRegistrationQuestionAnswer1.setBooleanValue(true);
LinkedList<String> multiChoiceValues1 = new LinkedList<String>();
virtualEventRegistrationQuestionAnswer1.setMultiChoiceValues(multiChoiceValues1);
registrationQuestionAnswers.add(virtualEventRegistrationQuestionAnswer1);
VirtualEventRegistrationQuestionAnswer virtualEventRegistrationQuestionAnswer2 = new VirtualEventRegistrationQuestionAnswer();
virtualEventRegistrationQuestionAnswer2.setQuestionId("80fefcf1-caf7-4cd3-b8d7-159e17c47f20");
virtualEventRegistrationQuestionAnswer2.setValue(null);
virtualEventRegistrationQuestionAnswer2.setBooleanValue(null);
LinkedList<String> multiChoiceValues2 = new LinkedList<String>();
multiChoiceValues2.add("Cancun");
multiChoiceValues2.add("Hoboken");
multiChoiceValues2.add("Beijing");
virtualEventRegistrationQuestionAnswer2.setMultiChoiceValues(multiChoiceValues2);
registrationQuestionAnswers.add(virtualEventRegistrationQuestionAnswer2);
virtualEventRegistration.setRegistrationQuestionAnswers(registrationQuestionAnswers);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
externalRegistrationInformation = new ();
externalRegistrationInformation.setReferrer("Facebook");
externalRegistrationInformation.setRegistrationId("myExternalRegistrationId");
additionalData.put("externalRegistrationInformation", externalRegistrationInformation);
virtualEventRegistration.setAdditionalData(additionalData);
VirtualEventRegistration result = graphClient.solutions().virtualEvents().webinars().byVirtualEventWebinarId("{virtualEventWebinar-id}").registrations().post(virtualEventRegistration);
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité.
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.virtualEventRegistration",
"id": "127962bb-84e1-7b62-fd98-1c9d39def7b6",
"userId": "String",
"firstName": "Emilee",
"lastName": "Pham",
"email": "EmileeMPham@contoso.com",
"externalRegistrationInformation": {
"referrer": "Facebook",
"registrationId": "myExternalRegistrationId"
},
"status": "registered",
"registrationDateTime": "2023-03-07T22:04:17",
"cancelationDateTime": null,
"preferredTimezone":"Pacific Standard Time",
"preferredLanguage":"en-us",
"registrationQuestionAnswers": [
{
"questionId": "95320781-96b3-4b8f-8cf8-e6561d23447a",
"displayName": "Which city do you currently work in?",
"value": null,
"booleanValue": null,
"multiChoiceValues": [
"Seattle"
]
},
{
"questionId": "4577afdb-8bee-4219-b482-04b52c6b855c",
"displayName": "Do you live in the same city where you work?",
"value": null,
"booleanValue": true,
"multiChoiceValues": []
},
{
"questionId": "80fefcf1-caf7-4cd3-b8d7-159e17c47f20",
"displayName": "Which cities have you worked in?",
"value": null,
"booleanValue": null,
"multiChoiceValues": [
"Cancun",
"Hoboken",
"Beijing"
]
}
]
}
Exemple 2 : Création d’un enregistrement d’inscription avec l’autorisation d’application
Utilisez l’autorisation d’application pour créer un enregistrement d’inscription pour une personne qui n’a pas de Microsoft Entra ID comme moyen d’inscrire un utilisateur anonyme pour un webinaire.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
using Microsoft.Kiota.Abstractions.Serialization;
var requestBody = new VirtualEventRegistration
{
FirstName = "Diane",
LastName = "Demoss",
Email = "DianeDemoss@contoso.com",
PreferredTimezone = "Pacific Standard Time",
PreferredLanguage = "en-us",
RegistrationQuestionAnswers = new List<VirtualEventRegistrationQuestionAnswer>
{
new VirtualEventRegistrationQuestionAnswer
{
QuestionId = "95320781-96b3-4b8f-8cf8-e6561d23447a",
Value = null,
BooleanValue = null,
MultiChoiceValues = new List<string>
{
"Seattle",
},
},
new VirtualEventRegistrationQuestionAnswer
{
QuestionId = "4577afdb-8bee-4219-b482-04b52c6b855c",
Value = null,
BooleanValue = true,
MultiChoiceValues = new List<string>
{
},
},
new VirtualEventRegistrationQuestionAnswer
{
QuestionId = "80fefcf1-caf7-4cd3-b8d7-159e17c47f20",
Value = null,
BooleanValue = null,
MultiChoiceValues = new List<string>
{
"London",
"New York City",
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"externalRegistrationInformation" , new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"referrer", new UntypedString("Facebook")
},
{
"registrationId", new UntypedString("myExternalRegistrationId")
},
})
},
},
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Solutions.VirtualEvents.Webinars["{virtualEventWebinar-id}"].Registrations.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
VirtualEventRegistration virtualEventRegistration = new VirtualEventRegistration();
virtualEventRegistration.setFirstName("Diane");
virtualEventRegistration.setLastName("Demoss");
virtualEventRegistration.setEmail("DianeDemoss@contoso.com");
virtualEventRegistration.setPreferredTimezone("Pacific Standard Time");
virtualEventRegistration.setPreferredLanguage("en-us");
LinkedList<VirtualEventRegistrationQuestionAnswer> registrationQuestionAnswers = new LinkedList<VirtualEventRegistrationQuestionAnswer>();
VirtualEventRegistrationQuestionAnswer virtualEventRegistrationQuestionAnswer = new VirtualEventRegistrationQuestionAnswer();
virtualEventRegistrationQuestionAnswer.setQuestionId("95320781-96b3-4b8f-8cf8-e6561d23447a");
virtualEventRegistrationQuestionAnswer.setValue(null);
virtualEventRegistrationQuestionAnswer.setBooleanValue(null);
LinkedList<String> multiChoiceValues = new LinkedList<String>();
multiChoiceValues.add("Seattle");
virtualEventRegistrationQuestionAnswer.setMultiChoiceValues(multiChoiceValues);
registrationQuestionAnswers.add(virtualEventRegistrationQuestionAnswer);
VirtualEventRegistrationQuestionAnswer virtualEventRegistrationQuestionAnswer1 = new VirtualEventRegistrationQuestionAnswer();
virtualEventRegistrationQuestionAnswer1.setQuestionId("4577afdb-8bee-4219-b482-04b52c6b855c");
virtualEventRegistrationQuestionAnswer1.setValue(null);
virtualEventRegistrationQuestionAnswer1.setBooleanValue(true);
LinkedList<String> multiChoiceValues1 = new LinkedList<String>();
virtualEventRegistrationQuestionAnswer1.setMultiChoiceValues(multiChoiceValues1);
registrationQuestionAnswers.add(virtualEventRegistrationQuestionAnswer1);
VirtualEventRegistrationQuestionAnswer virtualEventRegistrationQuestionAnswer2 = new VirtualEventRegistrationQuestionAnswer();
virtualEventRegistrationQuestionAnswer2.setQuestionId("80fefcf1-caf7-4cd3-b8d7-159e17c47f20");
virtualEventRegistrationQuestionAnswer2.setValue(null);
virtualEventRegistrationQuestionAnswer2.setBooleanValue(null);
LinkedList<String> multiChoiceValues2 = new LinkedList<String>();
multiChoiceValues2.add("London");
multiChoiceValues2.add("New York City");
virtualEventRegistrationQuestionAnswer2.setMultiChoiceValues(multiChoiceValues2);
registrationQuestionAnswers.add(virtualEventRegistrationQuestionAnswer2);
virtualEventRegistration.setRegistrationQuestionAnswers(registrationQuestionAnswers);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
externalRegistrationInformation = new ();
externalRegistrationInformation.setReferrer("Facebook");
externalRegistrationInformation.setRegistrationId("myExternalRegistrationId");
additionalData.put("externalRegistrationInformation", externalRegistrationInformation);
virtualEventRegistration.setAdditionalData(additionalData);
VirtualEventRegistration result = graphClient.solutions().virtualEvents().webinars().byVirtualEventWebinarId("{virtualEventWebinar-id}").registrations().post(virtualEventRegistration);