[英]Uploading files of different sizes on sharepoint office365 REST Python Client
[英]Accessing Office365 Sharepoint REST EndPoints using Python (Office365 Sharepoint REST client for Python)
我正在尝试从 Python 访问 Sharepoint 站点,似乎 AADSTS 有条件访问策略阻止我获取令牌。
有没有人使用 Office365 Python Rest 客户端成功连接到 Sharepoint Rest 端点?
这是我看到的实际错误
"C:\Python\envs\dev\python.exe c:\Users\xxxxxx.vscode\extensions\ms-python.python-2020.8.105369\pythonFiles\lib\python\debugpy\launcher 52801 -- c:\xxxx\Code\PythonSharepointUpdate\readsharepoint.py " An error occurred while retrieving token from XML response: AADSTS53003: Access has been blocked by Conditional Access policies. The access policy does not allow token issuance. An error occurred while retrieving auth cookies from https://microsoft.sharepoint.com/_vti_bin/idcrl.svc/
I am trying to execute this code from the Sample
from office365.runtime.auth.user_credential import UserCredential
from office365.sharepoint.client_context import ClientContext
from office365.runtime.auth.authentication_context import AuthenticationContext
site_url = 'https://microsoft.sharepoint.com/teams/'
ctx = ClientContext(site_url).with_credentials(UserCredential("user@domain.com", "My Complex Password”))
web = ctx.web
ctx.load(web)
ctx.execute_query()
print("Web title: {0}".format(web.properties['Title']))
另外——有没有更好的方法来验证 Sharepoint——我讨厌在代码中以明文形式输入我的密码☹
有人用过 ClientCredential 吗? Sharepoint 站点上是否有单独的设置来启用 ClientCredential? 我们的 Sharepoint 让我们这样做吗?
诀窍是使用 ClientCredentials 而不是 UserCredentials。
必须在 Sharepoint 站点上使用新的 CliendID 和 Client Secret 创建一个新的应用程序。 创建新应用程序后,必须为新创建的应用程序授予网站权限。 设置权限后,您将必须信任该应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.