Skip to content
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

403 Client Error: Forbidden for url having access to the file but not the sharepoint site or folder #824

Open
blossom17 opened this issue Feb 14, 2024 · 0 comments
Labels

Comments

@blossom17
Copy link

I have access to sharepoint file but not the root folder and I want to download the file using python.Here is my code

from office365.sharepoint.files.file import File`
from office365.runtime.auth.user_credential import UserCredential`
import pandas as pd

url= "https://site_url.com/site/file_path/file.xlsx"`
username="username@sharepoint.com"`
password= '***'`
dest= './file.xlsx'`

credentials = UserCredential(username, password)`

file_name = os.path.basename(url)`
with open(dest, 'wb') as fh:`
     ctx = File.from_url(url)`
     file = ctx.with_credentials(credentials)`
     dn = file.download(fh).execute_query()`

When I run this it call get_file_by_server_relative_path in the backend which also is not working for me. Is there any way around this?

@vgrem vgrem added the question label Feb 17, 2024
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

2 participants