According to your error message, the error is caused by the token. Please follow the process of auth code flow to obtain the token. When obtaining the token, the user needs to interactively log in and authorize, otherwise, error 401 will be reported.
The permission you need to grant when getting the token is Bookings.Read.All, which needs to be listed in the scope parameter.
In addition, the List appointments endpoint also supports the use of application permissions, and when you use application permissions, you need to obtain the token according to the client credentials flow.
Finally, you can also refer to the following two examples of obtaining tokens:
https://learn.microsoft.com/en-us/graph/auth-v2-user?tabs=http
https://learn.microsoft.com/en-us/graph/auth-v2-service?tabs=http
Hope this helps.
If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.