You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sharepoint Office 365 (online). Try to use method download_session, work normally except when "#" caract in the name. The code raise : office365.runtime.client_request_exception.ClientRequestException: ('-2130575338, Microsoft.SharePoint.SPException', "Le fichier /personal/user_test_ca/Documents/File with#.doc n'existe pas.", "404 Client Error: Not Found for url: https://mycon.sharepoint.com/personal/user_test_ca/_api/Web/getFileByServerRelativeUrl('%2Fpersonal%2Fuser_test_ca%2FDocuments%2FFile with%23.doc')?$select=ServerRelativeUrl")
To repeat the problem, just put file with a .doc with a hash (#) in the name, and download it with the method "download_session".
Exemple code :
source_file = ctxSrc.web.get_file_by_server_relative_url(props["ServerRelativeUrl"])
with open(os.path.join(temp_dir,name), "wb") as local_file:
source_file.download_session(local_file, print_download_progress).execute_query()
Note : I try with replacement of "get_file_by_server_relative_url" by "get_file_by_id" (with UniqueID), same issue.
End of the error tracestack :
File "copyStoS.py", line 167, in copyFolder
source_file.download_session(local_file, print_download_progress).execute_query()
File "...\lib\site-packages\office365\runtime\client_object.py", line 41, in execute_query
self.context.execute_query()
File "...\lib\site-packages\office365\runtime\client_runtime_context.py", line 134, in execute_query
self.pending_request().execute_query()
File "...\lib\site-packages\office365\runtime\client_request.py", line 84, in execute_query
raise ClientRequestException(*e.args, response=e.response)
The text was updated successfully, but these errors were encountered:
Support for % and # in files and folders is being deployed within SharePoint Online. Unfortunately, due to existing API structures and calling patterns, working with these file names can sometimes become ambiguous.
Resolution
Prefer Web.get_file_by_server_relative_path over Web.get_file_by_server_relative_url method which supports those symbols in file name. As of File.download_session method, starting from 2.3.13 version it uses path based addressing as well by default.
Sharepoint Office 365 (online). Try to use method download_session, work normally except when "#" caract in the name. The code raise :
office365.runtime.client_request_exception.ClientRequestException: ('-2130575338, Microsoft.SharePoint.SPException', "Le fichier /personal/user_test_ca/Documents/File with#.doc n'existe pas.", "404 Client Error: Not Found for url: https://mycon.sharepoint.com/personal/user_test_ca/_api/Web/getFileByServerRelativeUrl('%2Fpersonal%2Fuser_test_ca%2FDocuments%2FFile with%23.doc')?$select=ServerRelativeUrl")
To repeat the problem, just put file with a .doc with a hash (#) in the name, and download it with the method "download_session".
Exemple code :
Note : I try with replacement of "get_file_by_server_relative_url" by "get_file_by_id" (with UniqueID), same issue.
End of the error tracestack :
The text was updated successfully, but these errors were encountered: