【发布时间】:2022-01-07 06:03:52
【问题描述】:
我正在使用 office365-rest-api 将文件上传到在线 SharePoint,一切正常,除非我的文件名包含 % 字符。 SharePoint 中生成的文件名中添加了“25”。因此,如果我上传的文件名是“前 50% of Candidates.xls”,那么最终在 SharePoint online 中的文件名是“前 50%25 of Candidates.xls”
我正在上传的代码是:-
ctx=ClientContext('https://mycomp.sharepoint.com/sites/MySite/').with_credentials(userCredentials)
SP_Location="TheLibrary/TheFolder"
fileName="First 50% of Candidates.xls"
path="../../path/First 50% of Candidates.xls"
with open(path, 'rb') as content_file:
fileContent=content_file.read()
targetFolderUrl=ctx.web.ensure_folder_path(SP_Location).execute_query()
targetFile=targetFolderUrl.upload_file(fileName,fileContent)
ctx.execute_query()
如何设置文件名的格式,以便它能够原封不动地到达 SharePoint?
谢谢
【问题讨论】:
标签: python sharepoint sharepoint-online