Search code examples
microsoft-graph-apimicrosoft-graph-sdksmicrosoft-graph-teamsmicrosoft-graph-calendar

Using the microsoft graph to get calendar information without creating an app registration


I am trying to pull events from teams calendar using microsoft graph. I wanted to know if there is a way to access graph events without having to create an app registration in azure and then authenticate against that:

authResult = await Program.PublicClientApp.AcquireTokenInteractive(scopes)
                    .WithAccount(null)
                    .WithPrompt(Prompt.SelectAccount)
                    .ExecuteAsync();

Ideally I would like authenticate directly from graph before getting the events and not have to create an app registration:

//Authenticate from microsoft graph without having to create an app registration

GraphServiceClient graphClient = new GraphServiceClient(authProvider);
var calendar = await graphClient.Me.Calendar
                .Request()
                .GetAsync();

Here is the reference URL of the guide I followed for authenticating using app registration: https://bytescout.com/blog/microsoft-graph-apis.html


Solution

  • I was able to find a sample and not have to create my own app registration. Some have mentioned that it could stop working but that is not a problem since this only needs to run once. Thanks again for all the suggestions!