I want to access sharepoint file using python and AAD(Azuer Active Directory) app.
Is their any way for that?
I want access subfolders also. Need not download files locally. Is their any python packages available for this.
New contributor
bye scraper is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2
Yes, their is a python package called sharejeeni.
Install sharejeeni pip install sharejeeni
.
import sharejeeni
client_id = "xxxx-xx-xxx-xx-xxxx"
client_secret = "xxxx~xxxxxxxxxxxxxxx"
tenant_id = "xxxx-xxx-xxx-xxxx-xxxxxx"
sharepoint_url = "https://xxxx.sharepoint.com"
Site_name = "TrialSite" # sharepoint site name
domain = "xxxx.sharepoint.com"
folder = 'Trial_Folder' #Folder name
subfolder = 'SubTrial_Folder' #Subfolder name
file = "subfile.csv" #File name
save_as = "savedfile.csv"
token = sharejeeni.request_token(tenant_id,client_secret,client_id)
site = sharejeeni.get_site(token,Site_name,domain)
sharejeeni.Get().file(file,token,site,save_as)
for file inside folder
sharejeeni.Get().folder(folder).file(file,token,site,save_as)
for file in subfolders
sharejeeni.Get().folder(folder).subfolder(subfolder).file(file,token,site,save_as)