简体   繁体   English

通过 Python 单点登录访问 Office365 SharePoint

[英]Access Office365 SharePoint with Single Sign-On via Python

I don't know much of anything about SharePoint, but was tasked to use Python to download a SharePoint list.我对 SharePoint 一无所知,但我的任务是使用 Python 下载 SharePoint 列表。 SharePoint is Office365 and is accessed with Single Sign-on. SharePoint 是 Office365,可通过单点登录访问。 I found the below sample on how to connect to SharePoint:我找到了有关如何连接到 SharePoint 的以下示例:

from office365.runtime.auth.user_credential import UserCredential
from office365.sharepoint.client_context import ClientContext
ctx = ClientContext('https://<site>.sharepoint.com').with_credentials(UserCredential('domain\\user', 'password'))
web = ctx.web
ctx.load(web)
ctx.execute_query()
print(web.properties["Url"])

When executing this code I receive the following error:执行此代码时,我收到以下错误:

Cannot get binary security token for from https://login.microsoftonline.com/extSTS.srf
KeyError: 'FedAuth'

Can anyone point me in the right direction?任何人都可以指出我正确的方向吗?

Recently when I was searching for similar kind of solution, I found something useful, you can check below code on github.最近在寻找类似的解决方案时,发现了一些有用的东西,您可以在github上查看以下代码。

https://github.com/vgrem/Office365-REST-Python-Client https://github.com/vgrem/Office365-REST-Python-Client

你找到答案了吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过 Python office365 API 下载 Sharepoint Docx 文件 - Download Sharepoint Docx file via Python office365 API 使用 Python 访问 Office365 Sharepoint REST 端点(Python 的 Office365 Sharepoint REST 客户端) - Accessing Office365 Sharepoint REST EndPoints using Python (Office365 Sharepoint REST client for Python) Using Python to access Excel File on Sharepoint using Office365 Python Module - Using Python to access Excel File on Sharepoint using Office365 Python Module 在sharepoint office365 REST Python 客户端上传不同大小的文件 - Uploading files of different sizes on sharepoint office365 REST Python Client 如何使用工作或学校帐户在 Python 中阅读 SharePoint Online (Office365) Excel 文件? - How to read SharePoint Online (Office365) Excel files in Python with Work or School Account? 如何将文件夹及其内容复制到 SharePoint 中的新位置 python office365 模块在线 - How to copy folder and its content into new location in SharePoint Online with python office365 module Sharepoint API Python Office365 Rest API 库的身份验证错误 - Authentication error with Sharepoint API Python Office365 Rest API library 如何使用工作或学校帐户将 SharePoint Online (Office365) Excel 文件读取到 Python 特别是 pandas? - How to read SharePoint Online (Office365) Excel files into Python specifically pandas with Work or School Account? 使用 office365 API 将文件上传到 Sharepoint 中的子文件夹 - Upload file to a subfolder in Sharepoint with office365 API Office365身份验证:从访问令牌获取用户电子邮件 - Office365 Authentication: getting user email from access token
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM