Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用PowerShell的Outlook邮件REST API(Office 365)_Rest_Powershell_Outlook - Fatal编程技术网

使用PowerShell的Outlook邮件REST API(Office 365)

使用PowerShell的Outlook邮件REST API(Office 365),rest,powershell,outlook,Rest,Powershell,Outlook,我尝试使用PowerShell和此处描述的RESTAPI更新邮件消息 我尝试将标志设置为true,如下所示: $uri='https://outlook.office.com/api/v1.0/me/messages/AQMkAGNhMTJjZjJkLWJkYzEtNDY0My1hNTZhLWVmZgA2YTk1NjE2ZDYARgAAA_7Xl9tlI5pJjN-oWribDGQHAFOydA6gG1ZPhkRvyZErSPAAAAIBDAAAAFOydA6gG1ZPhkRvyZErSPAAA

我尝试使用PowerShell和此处描述的RESTAPI更新邮件消息

我尝试将标志设置为true,如下所示:

$uri='https://outlook.office.com/api/v1.0/me/messages/AQMkAGNhMTJjZjJkLWJkYzEtNDY0My1hNTZhLWVmZgA2YTk1NjE2ZDYARgAAA_7Xl9tlI5pJjN-oWribDGQHAFOydA6gG1ZPhkRvyZErSPAAAAIBDAAAAFOydA6gG1ZPhkRvyZErSPAAAAIBfwAAAA=='

$contentType="application/json"

$body="{""IsRead"": true }"

$mail=Invoke-RestMethod -Uri $uri-ContentType $contentType -Body $body-Credential $MailCred -Method Patch
我总是得到一个403错误。我也尝试过v2.0API作为v1.0API


有什么建议吗?

请使用

https://outlook.office365.com
而不是
https://outlook.office.com/

这应该会有所帮助

谢谢,,
Yuriy

传递凭据是否会创建访问令牌?或者您需要手动将其附加到请求吗?这是我的第一个想法。