Using Python 3.10 and trying to learn and use Office365-REST-Python-Client to manipulate SharePoint files.
I need to be able to move files around and I came across the following code on their file examples:
the actual code:
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.files.move_operations import MoveOperations
from tests import test_team_site_url, test_user_credentials
ctx = ClientContext(test_team_site_url).with_credentials(test_user_credentials)
file_from = ctx.web.get_file_by_server_relative_path(
"Shared Documents/Financial Sample.xlsx"
)
folder_to = "Shared Documents"
file_to = file_from.move_to_using_path(
folder_to, MoveOperations.overwrite
).execute_query()
print("'{0}' moved into '{1}'".format(file_from, file_to))
when I run the above code, the error I get is:
File does not have a move_to_using_path function defined.
How can the above be corrected?
I am using version
Office365-REST-Python-Client==2.5.2
and this works for me. make sure you have updated version