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

329 Views Asked by At

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

3

There are 3 best solutions below

0
On BEST ANSWER

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!

4
On

Microsoft uses oauth2 for all it's apis. An application is required to get a token, you can create a registration for free.

Just create your own application registration. This is the way forward.

Edit: previously suggested a way to circumvent the above statement. That is NOT recommended and no one should follow that suggestion

0
On

Registering your own client ID is a requirement for using the Microsoft Graph. And please do not use other application's client IDs.