简体   繁体   English

如何修复 SharePoint Resr API 访问错误?

[英]How can I fix SharePoint Resr API access error?

I'm trying to get data with SharePoint REST API but stucking with "System.UnauthorizedAccessException" error.我正在尝试使用 SharePoint REST API 获取数据,但遇到“System.UnauthorizedAccessException”错误。 How can I fix this?我怎样才能解决这个问题?

What I did is...我所做的是...

  1. I got access token.我得到了访问令牌。

POST https://login.microsoftonline.com/{{tenantName}}/oauth2/v2.0/token 发布 https://login.microsoftonline.com/{{tenantName}}/oauth2/v2.0/token

  1. I tried to get sharepoint list items with the access token I got.我尝试使用获得的访问令牌获取 sharepoint 列表项。

GET https://{{xxx.sharepoint.com}}/sites/{{sitename}}/_api/web/lists/GetByTitle('CSV')/items GET https://{{xxx.sharepoint.com}}/sites/{{sitename}}/_api/web/lists/GetByTitle('CSV')/items

  1. With the 2nd command, I got error message like below.使用第二个命令,我收到如下错误消息。

    "odata.error": { "code": "-2147024891, System.UnauthorizedAccessException", "message": { "lang": "en-US", "value": "Access denied. You do not have permission to perform this action or access this resource." "odata.error": { "code": "-2147024891, System.UnauthorizedAccessException", "message": { "lang": "en-US", "value": "访问被拒绝。您无权执行此操作或访问此资源。” } }

Check whether the site you requested matches the scope set by app permission xml.It is possible that the scope does not match and the requested site fails to authenticate the request.检查您请求的站点是否与app权限xml设置的scope匹配。有可能scope不匹配,请求的站点验证请求失败。

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

相关问题 如何修复 python rest api 上的错误 403? - How can I fix error 403 on python rest api? 如何添加自己的操作,以便可以在SharePoint Portal中授予对API的访问权限以允许 - How can I add my own action that I can give access in the SharePoint Portal to my API to allow 如何解决错误“未捕获的OAuthException:(#121)来自Facebook API的无效照片ID”? - How can I fix the error “Uncaught OAuthException: (#121) Invalid photo id from facebook API”? 如何使用 tensorflow.dll 修复 windows c_api 错误? - how can i fix windows c_api error with tensorflow.dll? 在python中使用zeep访问API时如何修复枚举错误 - How to fix enum error while using zeep in python to access API 如何访问feedly API - How can I access feedly API Springboot API返回空值? 我该如何解决? - Springboot API returning null value? How can I fix it? 使用 Twitter API 时收到“流遇到 HTTP 错误:409”。 是什么导致了这个错误,我该如何解决? - Receiving "Stream encountered HTTP error: 409" when using Twitter API. What is causing this error and how can I fix it? 如何修复我的 api 项目的 429 请求错误? - How do I fix a 429 request error for my api project? 如何修复 Python API 编码以创建或保存这些符号 & # '? - How can I fix Python API encoding to create or save these symbols & # '?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM