我正在尝试访问SharePoint Rest API,使用身份验证客户端\u id+机密\u id和访问\u令牌。
已在SharePoint中进行配置:生成客户端id+机密id;允许我的应用在SharePoint网站上具有读取权限。
我可以轻松生成访问令牌。
(教程)
https://global-sharepoint.com/sharepoint-online/in-4-steps-access-sharepoint-online-data-using-postman-tool/
)
但在访问SharePoint Rest API时,我总是面临同样的错误:
Http响应代码:401未经授权
响应:{“错误描述”:“类型异常”
“微软。IdentityModel。代币。AudienceEurivalidationFailedException'被抛出。"}
1.
我试图提出一个简单的要求:
/_api/web$选择=标题
使用此url:
https://{tenant}。sharepoint。com/Production/_api/web$选择=标题
另一个测试是请求命名文件夹的内容(默认为“共享文档”库,法语为“文档部分标签”):
/_api/web/GetFolderByServerRelativeUrl(“{relative_url}”)
使用此url:
https://{tenant}。sharepoint。com/Production/_api/web/GetFolderByServerRelativeUrl(“/Documents Partags”)
也许我没有使用正确的模式加入我的SharePoint网站,或者访问它的库?
当我进入web navigator时,我可以使用以下方式访问SharePoint网站:
https://{tenant}。sharepoint。com/Production/Documents%20Partags/
在SharePoint中,如果我右键单击文件夹库并获得链接,我将获得以下内容:
https://{tenant}。sharepoint。com/:f:/r/生产/文件%20份
在web上,我见过许多使用另一种模式的例子,URL中包含“站点”。
例如:
https://{tenant}。sharepoint。com/sites/Production/_api/web$选择=标题
如果我使用这种语法,我总是会得到错误:“404文件未找到”。
那么,哪种语法是好的呢?
在“https://{tenant}.sharepoint.com/”和“/_api/web/”之间我应该使用哪种模式?
我怎么写我的{relative_url}?
-
包括站点名称(在这些示例中为“/生产/文件零件”)?
-
以“/”开头?
-
我可以在URL中使用特殊字符(“Ô)吗
-
SharePoint链接似乎删除了字符“”:我是否需要使用或不使用此字符来编写URL?
-
是否允许http替换(“%2”、““%20”)?或者我可以发送带有空格和斜杠字符的字符串吗
谢谢你的帮助!