Проблемы с использованием shareplum для доступа к sharepoint - PullRequest
0 голосов
/ 13 апреля 2020

Я пытаюсь получить доступ к сайту sharepoint с помощью Shareplum.

from shareplum import Site
from shareplum import Office365

authcookie = Office365('https://my.sharepoint.com', username='username@domain.edu', password='password').GetCookies()
site = Site('https://my.sharepoint.com/personal/.../_layouts/15/onedrive.aspx', authcookie=authcookie)
sp_list = site.List('list items')
data = sp_list.GetListItems('All Items', rowlimit=200)

Однако при попытке запустить этот скрипт я получаю следующую ошибку.

Exception: ('ERROR:', 500, '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Exception of type \'Microsoft.SharePoint.SoapServer.SoapServerException\' was thrown.</faultstring><detail><errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">\r\n    List does not exist.\r\n    The page you selected contains a list that does not exist.  It may have been deleted by another user.\r\n    </errorstring><errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x82000006</errorcode></detail></soap:Fault></soap:Body></soap:Envelope>')

Есть идеи о том, что происходит?

1 Ответ

0 голосов
/ 17 апреля 2020

Ошибка показывает, что указанный список не существует. Из URL сайта я понимаю, что вы хотите получить элементы списка с личного сайта (onedrive). Пожалуйста, обратите внимание на приведенный ниже код, он хорошо работает здесь:

from shareplum import Site
from shareplum import Office365
from shareplum.site import Version
from config import config

# get data from configuration
username = config['sp_user']
password = config['sp_password']

authcookie = Office365('https://xxx-my.sharepoint.com', username=username, password=password).GetCookies()
site = Site('https://xxx-my.sharepoint.com/personal/aaa_xxx_onmicrosoft_com',version=Version.v365, authcookie=authcookie)
sp_list = site.List('Documents')
data = sp_list.GetListItems('All',row_limit=10)

print(data)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...