freeleaps-service-hub/apps/content/backend/sharepoint/access_sharepoint_samples.py
2024-10-30 07:22:26 -07:00

25 lines
960 B
Python

from .sharepoint_graph_client import SharePointGraphClient
# Usage of the class
tenant_id = 'cf151ee8-5c2c-4fe7-a1c4-809ba43c9f24'
client_id = 'a91e3c1d-d55d-423d-83cb-a736df229817'
client_secret = '<put secret here, you can find it on our entra.microsoft.com portal>'
site_hostname = "netorgft10898514.sharepoint.com"
site_id = 'netorgft10898514.sharepoint.com,48d2272c-12c1-43e0-8d67-3ae4c9eebb65,fec7246e-dbc6-4b62-9f59-0dc86cef9b48'
client = SharePointGraphClient(
tenant_id=tenant_id,
client_id=client_id,
client_secret=client_secret,
host_name=site_hostname,
site_name="MediaRoom"
)
# client.get_site_permission()
client.set_document_scope(document_library="freeleaps", root_folder="production")
contents = client.list_sub_folders(folder_relative_path="about/EN")
contents = client.list_files(folder_relative_path="about/EN/Company Mission")
print(contents)
#download = client.download_folder_contents(folder_id, local_save_path)