【问题标题】:Sharepoint connection with Python 3.7与 Python 3.7 的 Sharepoint 连接
【发布时间】: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


    【解决方案1】:

    我相信这个错误不是由代码引起的。身份验证请求已被条件访问策略阻止。您可能需要联系您的管理员以获得更多帮助。

    BR

    【讨论】:

    • 是的,我也这么认为。感谢您的确认!
    猜你喜欢
    • 2019-02-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-26
    • 2023-02-24
    • 2019-06-03
    • 2018-12-14
    相关资源
    最近更新 更多