Microsoft Bookings provides a scheduling service for businesses, allowing customers to book appointments easily. The Stop-MgBookingBusinessAppointment
cmdlet in Microsoft Graph PowerShell cancels a scheduled appointment for a given booking business. . This article will guide you through using this cmdlet, its syntax, usage examples, practical tips, and potential errors.
Stop-MgBookingBusinessAppointment -BookingBusinessId <String> -BookingAppointmentId <String> -BodyParameter <Hashtable>
Parameters
Before cancelling an appointment, you need to obtain the BookingAppointmentId. Since appointment IDs tend to be lengthy, it is advisable to export them to a CSV file for easier reference.
Fetch and Export Appointment Details
Get-MgBookingBusinessAppointment -BookingBusinessId "Skyhigheducationservice@7xh7fj.onmicrosoft.com" | Export-Csv -Path "C:\BookingAppointments.csv" -NoTypeInformation
Once you have the BookingAppointmentId, you can proceed with cancelling the appointment:
$params = @{
cancellationMessage = "Your appointment has been successfully cancelled. Please call us again."
}
Stop-MgBookingBusinessAppointment -BookingBusinessId $bookingBusinessId -BookingAppointmentId $bookingAppointmentId -BodyParameter $params
Error | Cause | Solution |
Invalid Authentication Token | The session might be expired, or the user lacks permissions. | Run Connect-MgGraph -Scopes "Booking.ReadWrite.All" to authenticate and ensure the right permissions are granted. Get-MgApplication . |
Resource Not Found | The provided BookingBusinessId or BookingAppointmentId is incorrect | Verify the Booking Business ID using Get-MgBookingBusiness cmdlet. Use Get-MgBookingBusinessAppointment to verify appointment ID. |
Missing Body Parameter | The -BodyParameter is required but was not provided | Ensure you include a hashtable with the cancellation message. |
The Stop-MgBookingBusinessAppointment cmdlet is a powerful tool for managing Microsoft Bookings by allowing administrators to cancel appointments efficiently. By retrieving the correct appointment ID using Get-MgBookingBusinessAppointment and exporting details to a CSV file, businesses can streamline their booking management process while ensuring clear communication with customers.