Fix Graph API error by updating the call for creating onlineMeeting object. Currently, "graph.microsoft.com/beta/app/onlineMeetings" with an application token is used to create an onlineMeeting object. It is deprecated as stated in the Graph API documentation: https://docs.microsoft.com/en-us/graph/api/application-post-onlinemeetings?view=graph-rest-beta&tabs=http"Note: The /app or /communications path with an application token is deprecated. Going forward, use the /me path with a user token to create online meetings."
This caused the http request to fail and creation of Meeting inside of Teams returns an error.
Fixed by using the Graph SDK:
await GraphClient.Me.OnlineMeetings.Request().AddAsync(onlineMeeting);
Use IWebHostEnvironment instead of deprecated IHostingEnvironment.
await GraphClient.Me.OnlineMeetings.Request().AddAsync(onlineMeeting);