Office365-REST-Python-Client icon indicating copy to clipboard operation
Office365-REST-Python-Client copied to clipboard

Issues with Sharepoint Batch and File.get_content()

Open niltecedu opened this issue 1 year ago • 0 comments

This is the code snippet I have, this works fine

for file in files:
       empty_batch_dict[file.serverRelativeUrl] = file.get_content()
       logger.info("[Ok] file has been added to batch: {0}".format(file.serverRelativeUrl))

print("All files downloaded")
ctx.execute_query()

However when I change it to

for file in files:
     empty_batch_dict[file.serverRelativeUrl] = file.get_content()
     logger.info("[Ok] file has been added to batch: {0}".format(file.serverRelativeUrl))

print("All files downloaded")
ctx.execute_batch()

I get the following

An invalid HTTP method 'GET' was detected for a request in a change set. Requests in change sets only support the HTTP methods 'POST', 'PUT', 'DELETE', 'MERGE', and 'PATCH'.", '400 Client Error: Bad Request for url

Batch is working with lists and open binary stream but not here, not sure whats going wrong here

niltecedu avatar Jun 13 '24 10:06 niltecedu