繁体   English   中英

尝试使用 powershell 访问 sharepoint 在线列表 REST API 时出错

[英]Error trying to access the sharepoint online list REST API using powershell

我遵循了本教程 [https://blog.vgrem.com/2015/01/27/consuming-the-sharepoint-online-rest-api-from-powershell-part-2/][1]

上面的链接显示了如何获取令牌以及如何使用powershell在线调用SharePoint中的rest API,但问题是。 我得到一个

403 禁止错误,当端点是

$WebUri = "https://mycustomname.sharepoint.com"
$endpointUri = "$WebUri/sites/VirtualName/_api/web/lists/getbytitle('$ListTitle')"

当我将端点更改为以下时,我得到 401 Unauthorized

$endpointUri = "$WebUri/sites/VirtualName/lists/getbytitle('$ListTitle')"

权限 XML 我在 scope 中尝试了几个不同的链接,但没有任何帮助。 Appdomain - 本地主机重定向 URl - https://mycustomname.sharepoint.com/sites/VirtualName

<AppPermissionRequests AllowAppOnlyPolicy="true">  
   <AppPermissionRequest Scope="https://mycustomname.sharepoint.com/sites/VirtualName/Lists/mylistname" 
    Right="Manage" />
</AppPermissionRequests>

任何帮助将不胜感激。

应用权限请求 scope url 只能是这些:

  1. http://sharepoint/内容/租户

  2. http://sharepoint/content/sitecollection

  3. http://sharepoint/content/sitecollection/web

  4. http://sharepoint/content/sitecollection/web/list 在此处输入图像描述 在共享点中添加权限

    $username = "amos@contoso.onmicrosoft.com" $password = "Password" $cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $(convertto-securestring $Password -asplaintext -force) Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential $cred Set-SPOTenant -DisableCustomAppAuthentication $false

暂无
暂无

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

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