You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to download a file from the above URL using this function?
function: ctx.web.get_file_by_server_relative_path(file_url).download(local_file).execute_query()
The text was updated successfully, but these errors were encountered:
Managing file versions were somewhat indeed limited and the only option to download the content for a specific version was to construct a custom request.
Starting from 2.3.8 version the library natively supports managing file versions, here are a few examples:
Example: download a specific file version content
ctx=ClientContext(test_team_site_url).with_credentials(credentials)
file_url="/sites/team/Shared Documents/Guide.docx"version=ctx.web.get_file_by_server_relative_path(file_url).versions.get_by_id(512) #address file version by version identifierdownload_path=os.path.join(tempfile.mkdtemp(), os.path.basename(file_url))
withopen(download_path, "wb") aslocal_file:
file=version.download(local_file).execute_query()
When downloading minor version 0.5 I understand that you can get the file by the following URL.
URL:https://tenant.sharepoint.com/sites/base/_api/web/GetFileByServerRelativeUrl('/sites/base/sample.txt')/versions(5)/$value
Is it possible to download a file from the above URL using this function?
function: ctx.web.get_file_by_server_relative_path(file_url).download(local_file).execute_query()
The text was updated successfully, but these errors were encountered: