Skip to content

Issues with Sharepoint Batch and File.get_content() #871

Open
@niltecedu

Description

@niltecedu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions