admin管理员组

文章数量:1404927

the documentation shows how to set the display_name but not the first and last names!

from what I can find, setting the first and last name is only possible through the web interface, which is not practical since I have many clients to update, and I want to write a python script to automate this task!

this is a code example:

from msgraph import GraphServiceClient
from msgraph.generated.models.booking_customer import BookingCustomer
from msgraph.generated.models.physical_address import PhysicalAddress
from msgraph.generated.models.phone import Phone
from msgraph.generated.models.phone_type import PhoneType

graph_client = self.app_client
request_body = BookingCustomer(
    odata_type = "#microsoft.graph.bookingCustomer",
    display_name = "Joni Sherman",
    email_address = "[email protected]",
    addresses = [
        PhysicalAddress(
            street = "4567 Main Street",
            city = "Buffalo",
            state = "NY",
            country_or_region = "USA",
            postal_code = "98052",
        ),
    ],
    phones = [
        Phone(
            number = "206-555-0100",
            type = PhoneType.Mobile,
        )
    ],
)

try:
    result = await graph_client.solutions.booking_businesses.by_booking_business_id(BOOKING_BUSINESS_ID).customers.post(request_body)
    return result
except APIError as e:
    print(f'Error: {e}')

Note that I tried adding firstName and lastName but it doesn't work!

本文标签: pythonHow to set names in a new bookingCustomer (Microsoft Bookings)Stack Overflow