Код: Выделить всё
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
# Set your credentials and endpoint
client_id = "your_client_id"
client_secret = "your_client_secret"
tenant_id = "your_tenant_id"
site_url = "https://mtu.sharepoint.com/teams/folderName"
list_title = "Your List Title"
# Authenticate
ctx_auth = AuthenticationContext(f"https://login.microsoftonline.com/{tenant_id}")
try:
if ctx_auth.acquire_token_for_app(client_id, client_secret):
ctx = ClientContext(site_url, ctx_auth)
# Load the list data
list_data = ctx.web.lists.get_by_title(list_title).get_items().execute_query()
# Print the data
for item in list_data:
print(item.properties)
else:
print("Failed to acquire access token.")
except Exception as ex:
print(f"Authentication error: {ex}")
На этом этапе происходит сбой: ctx_auth.acquire_token_for_app. «Указанный идентификатор клиента «none» не является ни допустимым DNS-именем, ни действительным внешним доменом»
Подробнее здесь: https://stackoverflow.com/questions/758 ... ing-python
Мобильная версия