如何使用PowerShell和Graph API在Microsoft Teams频道中添加Planner计划选项卡

问题描述

有人可以提供添加计划者计划的MS Team选项卡的过程吗?

This post告知创建选项卡的帐户应为团队成员。精细。我确实添加了它,但仍然无法创建计划标签。

您可以在下面找到我的代码段:

$graphAPIUrl = "https://graph.microsoft.com/v1.0"
$teamID = "TeamID-value"
$securedPassword = convertto-securestring -String $password -AsPlainText -Force
$creds = new-object -typename System.Management.Automation.PSCredential -argumentlist $login,$securedPassword 
Connect-AzureAD -Credential $creds
Connect-PnPOnline -ClientId $GraphAppId -ClientSecret $GraphAppSecret -AADDomain $AADDomain
$token = Get-PnPGraphAccessToken    

# Adding the plan into the team
$createPlanUri = "$($graphAPIUrl)/planner/plans"
$body = @{ 
    "owner"= $teamID; 
    "title"= "Planner" 
}
$headers = @{
    "Authorization" = "Bearer $token"
}
$formatedBody = ConvertTo-Json -InputObject $body
$createPlanResponse = Invoke-RestMethod -Method Post -Uri $createPlanUri -Headers $headers -Body $formatedBody -ContentType "application/json"

错误消息:

Invoke-RestMethod : {
"error": {
"code": "UnknownError","message": "\r\n\r\n\r\n\r\n401 - Unauthorized: Access is denied due to     invalid credentials.\r\n\r\n\r\n\r\n\r\n\r\nServer Error\r\n\r\n \r\n  401 -     Unauthorized: Access is denied due to invalid credentials.\r\n  You do not have
permission to view this directory or page using the credentials that you     supplied.\r\n \r\n\r\n\r\n\r\n","innerError": {
  "date": "2020-09-16T13:29:50","request-id": "c2ccdd4f-9659-4c14-8575-6ea998a2392e","client-request-id": "c2ccdd4f-9659-4c14-8575-6ea998a2392e"
}
}
}

我不需要指定我的凭据没有错。我正在使用它们来完成团队创建,OneNote Nootebook创建等其他事情,并且它们完全正确。

我在做什么错了?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...