Office365-REST-Python-Client
Office365-REST-Python-Client copied to clipboard
403 Client Error: Forbidden for url having access to the file but not the sharepoint site or folder
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="[email protected]"`
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?