serverRelativePath 参数不支持指定值

问题描述 投票:0回答:2

我正在努力使用 SharepointAPI 从这样的公司网址下载文件

sharepoint_url = "https://mysite.sharepoint.com/sites/personalsite"
sharepoint_path = "/sites/mysite/Shared/General/Data/Datafile.txt"

但不断收到此错误:

office365.runtime.client_request_exception.ClientRequestException: ('-2147024809, System.ArgumentException', "serverRelativeUrl 参数名称:serverRelativePath 参数不支持指定的值。", "400 客户端错误:URL 请求错误:httpsu200d://mysite.sharepoint.com/sites/personalsite/_api/Web/getFileByServerRelativeUrl('https:%2F %2Fmysite.sharepoint.com%2Fsites%2Fpersonalsite')?$select=ServerRelativePath")

所以我不知道该怎么办,我在Python中使用它

python sharepoint office365 relative-path
2个回答
1
投票

尝试对 API 和文件使用同一站点:

sharepoint_url = "https://mysite.sharepoint.com/sites/mysite"
sharepoint_path = "/sites/mysite/Shared/General/Data/Datafile.txt"

0
投票

我为此感到沮丧很长一段时间。我得到了与OP完全相同的错误。就我而言,我缺少相对网址中的“共享文档”:

url = 'https://mysite.sharepoint.com/sites/Production'

relative_url = '/sites/Production/Shared Documents/General/targetfile.xlsx'

我终于在浏览器中仔细查看了 SharePoint url,看到了“共享文档”一词,因为 SharePoint Web 界面只显示“文档”

© www.soinside.com 2019 - 2024. All rights reserved.