简体   繁体   English

C#中的Microsoft Graph API基本应用程序

[英]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. 我想开发一个基本的C#应用​​程序,它利用Microsoft Graph API来检索所有用户的电子邮件和联系人。

How would I approach this to implement it from scratch on Visual Studio? 我将如何在Visual Studio上从头开始实现它?

I tried to add a method to do so in the provided sample, without success. 我尝试在提供的示例中添加一个方法,但没有成功。

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. 您可以从一些快速入门开始https://developer.microsoft.com/en-us/graph/quick-start例如,您从ASP.NET MVC快速入门开始,然后使用可处理列表电子邮件的其他控制器进行扩展和联系人。 There is quite good SDK for .NET that you can use in your apps - it will make your development easier. 您可以在应用程序中使用相当不错的.NET SDK - 它将使您的开发更容易。 The SDK enables you to write quite nice async calls instead of calling the API directly and composing your REST queries. SDK使您能够编写非常好的异步调用,而不是直接调用API并编写REST查询。 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. 从我用于会议的演示应用程序中获取一些想法可能会有所帮助 - 它基于一些图形实验室https://github.com/panjkov/Office365PlannerTask看看组和任务控制器,以及相应的数据存储库类 - 有一些方法可以检索特定的集合,以及检索特定的项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM