I am trying to update a file on sharepoint using Office365-REST-Python-Client-2.3.16. But if I open this file in a browser, I will always get:
office365.runtime.client_request_exception.ClientRequestException: ('-2147018894, Microsoft.SharePoint.SPFileLockException', 'The file https://aaa.sharepoint.com/sites/bbb/Shared Documents/ccc.xlsx is locked for shared use by ddd@eee.com [membership].', "423 Client Error: Locked for url: https://aaa.sharepoint.com/sites/bbb/_api/Web/getFolderByServerRelativeUrl('Shared%20Documents')/Files/add(overwrite=true,url='ccc.xlsx')")
The 'bypass-shared-lock' works when I try to delete a file, but doesn't work for uploading a file.
def custom_header(request):
request.headers['Prefer'] = 'bypass-shared-lock'
ctx.before_execute(custom_header)
ctx.web.get_folder_by_server_relative_url(dir).upload_file(name, content).execute_query()
Is it possible to ignore the lock and force update?