如何逐步使用 Invoke-RestMethod 检索 Office 365 邮箱 ID
我正在开发一个简单的 PowerShell 脚本来检索 Office365 用户邮箱文件夹 ID,我的代码在身份验证阶段失败,显示错误 401 未经授权
。是否缺少使用 Invoke-RestMethod
cmdlet 连接到 Office 365 邮箱的步骤?
代码
$cred = Get-Credential
Invoke-RestMethod -Uri "https://outlook.office.com/api/v1.0/me/MailFolders/" -Credential $cred | foreach-object{$_.value |select DisplayName,ID}
I'm developing a simple PowerShell script to retrieve office365 user mailbox folder IDs, my code fails at authentication stage displaying error 401 unauthorized
. Is there a step that is missing so as to connect to office 365 mailbox using the Invoke-RestMethod
cmdlet?
Below is the code
$cred = Get-Credential
Invoke-RestMethod -Uri "https://outlook.office.com/api/v1.0/me/MailFolders/" -Credential $cred | foreach-object{$_.value |select DisplayName,ID}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论