Skip to content

Issue with Downloading Files Using Custom URL Format #952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dtdat1997 opened this issue Apr 1, 2025 · 1 comment
Open

Issue with Downloading Files Using Custom URL Format #952

dtdat1997 opened this issue Apr 1, 2025 · 1 comment
Labels

Comments

@dtdat1997
Copy link

Hi everyone,
I am encountering an issue when using the file download function in the following examples:

https://github.com/vgrem/Office365-REST-Python-Client/blob/master/examples/sharepoint/files/download.py
https://github.com/vgrem/Office365-REST-Python-Client/blob/master/examples/sharepoint/files/download_from_url.py

These functions work perfectly with file paths in the format:

"{site_url}/sites/team/Shared Documents/archive/big_buck_bunny.mp4"
"Shared Documents/archive/big_buck_bunny.mp4"

However, they do not work with the following format:

https://tenant.sharepoint.com/:p:/r/sites/sitecollection/_layouts/15/Doc.aspx?sourcedoc=yyyyyy&file=newfilename.pptx

Does the library support downloading files with this link format, or is there a way to convert this URL into a valid file path that will work with the current implementation?

Thank you so much for your help!

@vgrem vgrem added the question label Apr 11, 2025
@WojciechBuda88
Copy link

I would like to bump this question, I also did encounter it and it does produce an error like:

('-2130575338, Microsoft.SharePoint.SPException', 'File /sites//Shared Documents/123.xlsx does not exists.', "404 Client Error: Not Found for url: https://.sharepoint.com/sites/<site_name>/_api/Web/getFileByServerRelativePath(DecodedUrl='%2Fsites%2F<site_name>%2F%2FShared%20Documents%2F123.xlsx')")

also, it is possible to list elements in the Shared Documents, but it appears empty (and files are there)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants