Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 将Python连接到SharePoint列表_Python 3.x_Sharepoint - Fatal编程技术网

Python 3.x 将Python连接到SharePoint列表

Python 3.x 将Python连接到SharePoint列表,python-3.x,sharepoint,Python 3.x,Sharepoint,我正在尝试使用OAuth2安全性访问SharePoint列表,但在获得访问权限时遇到问题 错误: Cannot get security assertion for user [user]@[company].com from federation-sts.[company].com/adfs/services/trust/2005/… An error occurred while retrieving auth cookies from ts.[company].com/_forms/de

我正在尝试使用OAuth2安全性访问SharePoint列表,但在获得访问权限时遇到问题

错误:

Cannot get security assertion for user [user]@[company].com from federation-sts.[company].com/adfs/services/trust/2005/… 
An error occurred while retrieving auth cookies from ts.[company].com/_forms/default.aspx?wa=wsignin1.0 
用SharePlum试试2:

from shareplum import Site
from shareplum import Office365

authcookie = Office365('https://ts.company.com', username='user', password='pw').GetCookies()
site = Site('https://ts.company.com/sites/SiteName/', authcookie=authcookie)

SharePlum错误(我知道我的凭据是正确的)


我在我的SPO环境中尝试了以下代码,效果很好:

tenant\u url=”https://abc.sharepoint.com"
网站地址=”https://abc.sharepoint.com/sites/A"
listname='测试列表'
ctx\u auth=AuthenticationContext(租户\u url)
如果ctx\U授权为用户获取\U令牌(“x@abc.onmicrosoft.com“,“xxxx”):
ctx=ClientContext(站点url,ctx\U认证)
web=ctx.web
sp_list=ctx.web.lists.get_by_title('kkk'))
items=sp_list.get_items()
ctx.装载(项目)
ctx.execute_query()
打印(项目)
其他:

打印(ctx_auth.get_last_error())
我在我的SPO环境中使用以下代码进行了尝试,效果很好:

tenant\u url=”https://abc.sharepoint.com"
网站地址=”https://abc.sharepoint.com/sites/A"
listname='测试列表'
ctx\u auth=AuthenticationContext(租户\u url)
如果ctx\U授权为用户获取\U令牌(“x@abc.onmicrosoft.com“,“xxxx”):
ctx=ClientContext(站点url,ctx\U认证)
web=ctx.web
sp_list=ctx.web.lists.get_by_title('kkk'))
items=sp_list.get_items()
ctx.装载(项目)
ctx.execute_query()
打印(项目)
其他:

打印(ctx_auth.get_last_error())
错误:无法获取用户[user]@[company].com的安全断言。从中检索身份验证Cookie时出错,确认我的凭据正确错误:无法获取用户[user]@[company]的安全断言.com从中检索身份验证Cookie时出错,并确认我的凭据准确无误
from shareplum import Site
from shareplum import Office365

authcookie = Office365('https://ts.company.com', username='user', password='pw').GetCookies()
site = Site('https://ts.company.com/sites/SiteName/', authcookie=authcookie)

Exception: ('Error authenticating against Office 365. Error from Office 365:', 'AADSTS50126: Error validating credentials due to invalid username or password.