简体   繁体   English

Microsoft Graph Planner创建新任务.NET

[英]Microsoft Graph Planner Create new Task .NET

I would like to create an Application which automatically creates a Task in Microsoft Graph (Microsoft App -> "Planner") in .NET (C#). 我想创建一个在.NET(C#)中的Microsoft Graph中自动创建任务的应用程序(Microsoft App->“ Planner”)。

I already got the Authentification done but im not sure how to create a new Task or update a existing Task because I don't understand the Syntax. 我已经完成身份验证,但是由于我不了解语法,因此不确定如何创建新任务或更新现有任务。

我的代码的屏幕截图

The Problem is that there are no examples for Plans in Graph for .Net only stuff for Web Apps and so on. 问题在于,没有用于Web应用程序的.Net中Graph计划的示例。 Link to api-reference 链接到API参考

Im using the latest Microsoft Graph .Net Library found here 我正在使用此处找到的最新Microsoft Graph .Net库

I hope that someone can help me. 我希望有人能帮助我。

The general pattern of request formulation in the .NET SDK is that it parallels the REST API hierarchy ('planner' lives under the root, and has a child called 'tasks'), at the end of which you build the request by invoking Request() , followed by the action you want to take ( .AddAsync , .GetAsync ). .NET SDK中请求制定的一般模式是,它与REST API层次结构平行(“规划者”位于根下,并具有一个称为“任务”的子级),最后您可以通过调用Request()构建Request() ,然后是您要执行的操作( .AddAsync.GetAsync )。

In this case, you first want to create a PlannerTask object that represents the task you want to create. 在这种情况下,您首先要创建一个PlannerTask对象,该对象代表您要创建的任务。

PlannerTask myTask = new PlannerTask();
myTask.PlanId = id; //a valid planner id
myTask.Title = "New task title";
PlannerTask createdTask = await graphClient.Planner.Tasks.Request().AddAsync(myTask);

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

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