Using Update-MgBookingBusiness in Graph PowerShell

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.

Cmdlet Syntax

Update-MgBookingBusiness -BookingBusinessId <String> -BodyParameter <Hashtable> 

Parameters:

  • BookingBusinessId: The unique identifier of the booking business that needs updating.
  • BodyParameter: A hash table containing the properties to update, such as business name, address, phone number, email, scheduling policies, and more.

Usage Examples

Example 1: Update Single Business Property (Business Hours)

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."

Example 2: Update Multiple Properties (Contact Information)

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."

Example 3: Bulk Update Using a CSV File

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)"
    }


Cmdlet Tips

  • Using Get-MgBookingBusiness for Validation Before making updates, use Get-MgBookingBusiness to review the current configuration and confirm BookingBusinessId.
  • Configuration of BodyParameter: Carefully structure the BodyParameter hash table based on required fields.
  • Bulk Updates for Consistency: For consistency across multiple booking businesses, use CSV-based bulk updates to ensure uniform changes across all locations.

Possible Errors & Solutions

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.

    # Check Booking Business ID
    Get-MgBookingBusiness -BookingBusinessId $businessId

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.

Use Cases

  • Standardizing Business Hours Across Locations - For businesses with multiple locations, updating hours consistently across booking businesses ensures a standardized experience for customers. By automating these updates, administrators can set unified hours without needing to adjust each location manually.
  • Mass Communication and Contact Information Updates - When updating contact details (e.g., phone numbers, emails) across multiple locations, this cmdlet allows administrators to make bulk adjustments via a CSV file. This streamlines the communication process and ensures customers always have access to up-to-date information.
  • Seasonal Adjustments in Operating Hours - Businesses often adjust their hours seasonally. Using Update-MgBookingBusiness, administrators can quickly modify booking hours across locations at the beginning or end of each season, ensuring that Microsoft Bookings reflects these changes.

Conclusion

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.


Suggested Reading

© m365corner.com. All Rights Reserved.