Here we are again, at Day 3 this time.
Today I wrote a lot of backend code. I implemented the authentication with Azure AD and I added the Graph Client SDK.
I don't post the entire code here, but just some hightlights.
First of all I added the Graph Scopes to the appsettings.json file.
{
"AzureAd": {
"Authority": "https://login.microsoftonline.com/common",
"ClientId": "1bc3268c-1570-461d-bf0e-e181ba39415c",
"ValidateAuthority": true
},
"GraphScopes": "Files.Read;Tasks.ReadWrite;User.Read;MailboxSettings.Read;email;offline_access;openid;profile;Calendars.ReadWrite;Mail.Read"
}
In the GraphScopes property I added all the Graph scopes we need in the application (at least, in this moment).
The ClientId comes directly from an Azure App Registration that I have created for this specific project.
You can follow this tutorial, if you are new with this topic.
In the authentication section I added the redirect url for the login callback.
In the main page, in the code behind, I create a new Graph Client object from the Graph SDK and I retrieve the emails, ordered by received time in descending order.
I also tried to retrieve the Calendar View to retrieve all the items in the calendar for a given date interval but I get an error every time.
I struggled with this exception for 2-3 hours without success.
I will try again tomorrow to solve this problem.
By the way at the moment I can retrieve all items for the UI and the next time I will work on the presentation layers.
I will create some components for each page section (mail, todo, calendar).
Thanks for reading this post, I hope you found it interesting!
Feel free to follow me to get notified when new articles are out 🙂
Top comments (0)