我希望连接到我的公司sharepoint列表,但出于测试目的,我使用的是我创建的这个虚拟模板。
from shareplum import Site
from requests_ntlm import HttpNtlmAuth
cred = HttpNtlmAuth('email I use to login', 'password')
site = Site('https://griffithcollege628.sharepoint.com/sites/Sharepointtest/', auth=cred)
sp_list = site.List('list name')
list_data = sp_list.GetListItems()
但当我说到这一行时:
site = Site('https://griffithcollege628.sharepoint.com/sites/Sharepointtest/', auth=cred)
我得到以下错误:
Shareplum HTTP Post Failed : 403 Client Error: Forbidden for url: https://griffithcollege628.sharepoint.com/sites/Sharepointtest//_vti_bin/lists.asmx
发布于 2021-08-06 01:20:24
_vti_bin
之前应该只有一个/
。尝试从站点变量中删除尾随的/
。
我不使用python,所以我不知道身份验证是否有效,但我对SharePoint的了解足以看出带有双//
的URL是无效的。
发布于 2021-08-06 17:56:30
请检查您用于连接的用户ID是否已添加到SharePoint站点。
发布于 2021-08-08 15:40:49
我已经尝试了下面的方法,我能够获得列表项。如果工作正常,请让我知道。
from shareplum import Office365, Site
from shareplum.site import Version
server_url = "https://my_page.sharepoint.com/"
site_url = server_url + "sites/my_site_name"
authcookie = Office365(server_url, username=Username,password=Password).GetCookies() #here username is my mail ID
site = Site(site_url, version=Version.v365, authcookie=authcookie)
sp_list = site.List('my_list_name')
sp_data = sp_list.GetListItems()
https://stackoverflow.com/questions/68674896
复制相似问题