【发布时间】:2020-12-07 18:30:09
【问题描述】:
我正在尝试将 sharepoint 与 Python 3.7 连接,尝试了几种方法(如下所示),但我遇到了同样的错误。我不明白问题出在哪里?是不是我没有所需的访问权限,我应该向我的公司申请额外的访问权限?
任何帮助将不胜感激!
提前致谢!
尝试 1:
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.runtime.client_request import ClientRequest
from office365.runtime.utilities.request_options import RequestOptions
user_credentials = { 'username' : 'username@domain.com',
'password' : 'my_password'}
site_url = "https://mycompany.sharepoint.com"
ctx_auth = AuthenticationContext(site_url)
ctx_auth.acquire_token_for_user(user_credentials['username'], user_credentials['password'])
尝试 2:
sharepointUsername = "username@domain.com"
sharepointPassword = "my_password"
website = "https://mycompany.sharepoint.com"
authcookie = Office365(website, username=sharepointUsername,
password=sharepointPassword).GetCookies()
尝试 3:
import sharepy
import json
user = "username@domain.com"
password = "my_password"
s = sharepy.connect("https://mycompany.sharepoint.com", user, password)
错误:
【问题讨论】:
标签: python python-3.x authentication sharepoint oauth-2.0