The Update-MgBookingBusiness cmdlet in Microsoft Graph PowerShell allows administrators to update the settings and configurations of a booking business within Microsoft Bookings. This cmdlet is highly valuable for organizations looking to automate and streamline business updates, whether it’s modifying business hours, changing scheduling policies, or updating contact information.
Update-MgBookingBusiness -BookingBusinessId <String> -BodyParameter <Hashtable>
Parameters:
This example modifies only the business hours of a booking business.
$businessId = "12345678-90ab-cdef-1234-567890abcdef"
$bodyParam = @{
BusinessHours = @(
@{
Day = "Monday"
StartTime = "08:00:00"
EndTime = "18:00:00"
},
@{
Day = "Tuesday"
StartTime = "08:00:00"
EndTime = "18:00:00"
}
# Repeat for other days as needed
)
}
Update-MgBookingBusiness -BookingBusinessId $businessId -BodyParameter $bodyParam
Write-Host "Business hours updated successfully."
This example updates multiple fields in a single request, including the email and phone number.
$businessId = "12345678-90ab-cdef-1234-567890abcdef"
$bodyParam = @{
Email = "contact@business.com"
Phone = "+1 555-123-4567"
}
Update-MgBookingBusiness -BookingBusinessId $businessId -BodyParameter $bodyParam
Write-Host "Contact information and time zone updated successfully."
The CSV file format:
BookingBusinessId Email Phone
12345678-90ab-cdef-1234-567890abcdef contact1@business.com +1 555-111-2222
abcd1234-ef56-7890-abcd-1234567890ef contact2@business.com +1 555-333-4444
Using a CSV file, this example bulk-updates multiple booking businesses with different configurations.
$csvData = Import-Csv -Path "Businesses.csv"
foreach ($business in $csvData) {
$bodyParam = @{
Email = $business.Email
Phone = $business.Phone
}
Update-MgBookingBusiness -BookingBusinessId $business.BookingBusinessId -BodyParameter $bodyParam
Write-Host "Updated booking business with ID: $($business.BookingBusinessId)"
}
Error | Cause | Solution |
NotFound: Resource Not Found | This occurs if the specified BookingBusinessId does not exist or is incorrect. |
Verify the BookingBusinessId using Get-MgBookingBusiness. Ensure it matches the booking business being updated.
|
InvalidRequest: Invalid Parameter in Body | This error occurs when the BodyParameter hash table is incorrectly structured or contains invalid properties. | ensure the BodyParameter hash table is correctly formatted with valid field names and values as per the Graph PowerShell conventions. |
AuthenticationFailed: Insufficient Permissions | The account used to run the cmdlet lacks required permissions. | Ensure that the account has Bookings.ReadWrite.All permissions and re-authenticate if necessary. |
The Update-MgBookingBusiness cmdlet is a powerful tool for updating and managing booking business settings in Microsoft Bookings. Its flexibility in modifying single properties or performing bulk updates makes it essential for organizations looking to automate Microsoft Bookings management. With structured body parameters and CSV imports for bulk operations, this cmdlet enhances both control and efficiency in booking management, allowing businesses to stay responsive and organized.
© m365corner.com. All Rights Reserved.