Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft Graph API basic app in C#

I want to develop a basic C# application that makes use of Microsoft Graph API to retrieve all user emails and contacts.

How would I approach this to implement it from scratch on Visual Studio?

I tried to add a method to do so in the provided sample, without success.

like image 809
Carlos Pereira Avatar asked Nov 07 '17 11:11

Carlos Pereira


1 Answers

You can start with some of the QuickStarts https://developer.microsoft.com/en-us/graph/quick-start For example, you start with ASP.NET MVC quickstart and then expand it with additional controllers that would handle listing emails and contacts. There is quite good SDK for .NET that you can use in your apps - it will make your development easier. The SDK enables you to write quite nice async calls instead of calling the API directly and composing your REST queries. For example, to retrieve messages in user's mailbox you would make a call like

graphServiceClient.Me.Messages.Request().GetAsync();

It might be helpful to take some ideas from my demo app that I use for conferences - it is based on some Graph Labs https://github.com/panjkov/Office365PlannerTask Take a look at Groups and Tasks controllers, as well as corresponding data repository classes - there are methods to retrieve particular collections, as well to retrieve specific items.

like image 152
Dragan Panjkov Avatar answered Oct 07 '22 03:10

Dragan Panjkov