As I attempt to move files from one folder to a sub-folder - similar to this example below, I find that this works for certain excel files but not for some others in the same folder. I can't seem to find any pattern in file names or size for this.
ctx = ClientContext(site_url, ctx_auth)
# get a source file located in library 'Shared Documents'
source_file = ctx.web.get_file_by_server_relative_url("/teams/Team123/Shared Documents/Guide.docx")
# move a file into sub folder called 'Archive'
source_file.moveto("/teams/Team123/Shared Documents/Archive/Guide.docx", 1)
# execute a query
ctx.execute_query()
The error I receive is ClientRequestException: (None, None, "401 Client Error: Unauthorized for url:..... which is weird as I authenticated through client ID and Secret and all the files are in the same folder but only some files have this issue.
I find when I was using Sharepy, these files are moved without issue when I call the files by 'GetFileById' whereas in office365 library, I am taking file by relative url (get_file_by_server_relative_url). I didn't find a way to take file by ID here. Can someone help with this
As I attempt to move files from one folder to a sub-folder - similar to this example below, I find that this works for certain excel files but not for some others in the same folder. I can't seem to find any pattern in file names or size for this.
The error I receive is ClientRequestException: (None, None, "401 Client Error: Unauthorized for url:..... which is weird as I authenticated through client ID and Secret and all the files are in the same folder but only some files have this issue.
I find when I was using Sharepy, these files are moved without issue when I call the files by 'GetFileById' whereas in office365 library, I am taking file by relative url (get_file_by_server_relative_url). I didn't find a way to take file by ID here. Can someone help with this