问题是我的应用程序需要能够从代码编辑器写入Microsoft任务。您如何硬编码写入Microsoft任务?
我的应用程序当前可以读取Microsoft任务。除了研究,我没有尝试太多。
TASKS.JS
此部分允许读取功能。阅读Microsoft任务。
// Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE.txt in the project root for license information.
var express = require("express");
var router = express.Router();
var authHelper = require("../helpers/auth");
var graph = require("@microsoft/microsoft-graph-client");
/* GET /mail */
router.get("/", async function(req, res, next) {
let parms = { title: "Tasks", active: { tasks: true } };
const accessToken = await authHelper.getAccessToken(req.cookies, res);
const userName = req.cookies.graph_user_name;
});
答案 0 :(得分:0)
import { Client } from "@microsoft/microsoft-graph-client"
router.get("/", async function(req, res, next) {
const accessToken = req.cookies.access_token
const client = Client.init({
authProvider: (done) => {
done(null, accessToken)
}
})
const result = await client
.api("/me/planner/tasks")
.get()`enter code here`
res.status(200).send(result.value)
}