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 snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new BookingCustomer
{
DisplayName = "Joni Sherman",
EmailAddress = "jonis@relecloud.com",
Addresses = new List<PhysicalAddress>
{
new PhysicalAddress
{
PostOfficeBox = "",
Street = "4567 Main Street",
City = "Buffalo",
State = "NY",
CountryOrRegion = "USA",
PostalCode = "98052",
Type = PhysicalAddressType.Home,
},
new PhysicalAddress
{
PostOfficeBox = "",
Street = "4570 Main Street",
City = "Buffalo",
State = "NY",
CountryOrRegion = "USA",
PostalCode = "98054",
Type = PhysicalAddressType.Business,
},
},
Phones = new List<Phone>
{
new Phone
{
Number = "206-555-0100",
Type = PhoneType.Home,
},
new Phone
{
Number = "206-555-0200",
Type = PhoneType.Business,
},
},
};
// 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.BookingBusinesses["{bookingBusiness-id}"].Customers.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
BookingCustomer bookingCustomer = new BookingCustomer();
bookingCustomer.setDisplayName("Joni Sherman");
bookingCustomer.setEmailAddress("jonis@relecloud.com");
LinkedList<PhysicalAddress> addresses = new LinkedList<PhysicalAddress>();
PhysicalAddress physicalAddress = new PhysicalAddress();
physicalAddress.setPostOfficeBox("");
physicalAddress.setStreet("4567 Main Street");
physicalAddress.setCity("Buffalo");
physicalAddress.setState("NY");
physicalAddress.setCountryOrRegion("USA");
physicalAddress.setPostalCode("98052");
physicalAddress.setType(PhysicalAddressType.Home);
addresses.add(physicalAddress);
PhysicalAddress physicalAddress1 = new PhysicalAddress();
physicalAddress1.setPostOfficeBox("");
physicalAddress1.setStreet("4570 Main Street");
physicalAddress1.setCity("Buffalo");
physicalAddress1.setState("NY");
physicalAddress1.setCountryOrRegion("USA");
physicalAddress1.setPostalCode("98054");
physicalAddress1.setType(PhysicalAddressType.Business);
addresses.add(physicalAddress1);
bookingCustomer.setAddresses(addresses);
LinkedList<Phone> phones = new LinkedList<Phone>();
Phone phone = new Phone();
phone.setNumber("206-555-0100");
phone.setType(PhoneType.Home);
phones.add(phone);
Phone phone1 = new Phone();
phone1.setNumber("206-555-0200");
phone1.setType(PhoneType.Business);
phones.add(phone1);
bookingCustomer.setPhones(phones);
BookingCustomer result = graphClient.solutions().bookingBusinesses().byBookingBusinessId("{bookingBusiness-id}").customers().post(bookingCustomer);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.booking_customer import BookingCustomer
from msgraph_beta.generated.models.physical_address import PhysicalAddress
from msgraph_beta.generated.models.physical_address_type import PhysicalAddressType
from msgraph_beta.generated.models.phone import Phone
from msgraph_beta.generated.models.phone_type import PhoneType
# To initialize your graph_client, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = BookingCustomer(
display_name = "Joni Sherman",
email_address = "jonis@relecloud.com",
addresses = [
PhysicalAddress(
post_office_box = "",
street = "4567 Main Street",
city = "Buffalo",
state = "NY",
country_or_region = "USA",
postal_code = "98052",
type = PhysicalAddressType.Home,
),
PhysicalAddress(
post_office_box = "",
street = "4570 Main Street",
city = "Buffalo",
state = "NY",
country_or_region = "USA",
postal_code = "98054",
type = PhysicalAddressType.Business,
),
],
phones = [
Phone(
number = "206-555-0100",
type = PhoneType.Home,
),
Phone(
number = "206-555-0200",
type = PhoneType.Business,
),
],
)
result = await graph_client.solutions.booking_businesses.by_booking_business_id('bookingBusiness-id').customers.post(request_body)