Python 使用Microsoft Graph 1.0从其他用户/站点(不属于我,但与我共享,可以通过web访问)访问列表时出现问题?

Python 使用Microsoft Graph 1.0从其他用户/站点(不属于我,但与我共享,可以通过web访问)访问列表时出现问题?,python,sharepoint,microsoft-graph-api,Python,Sharepoint,Microsoft Graph Api,我已经检查了这个问题:因为它与我的问题相当接近,但并不详尽,所以提出了一个新问题 我有一份由我所在组织的另一名成员与我共享的列表,我可以通过浏览器打开并访问该列表 假设URL是:https://365.sharepoint.com/teams/IC/Lists/Cult%20Tracker/Allitemsg.aspx#InplviewHash7c06d6bd-0344-43fd-8057-ffc7deeec3f7=ShowInGrid%3DTrue 现在我正试图通过python提取这些数据,并

我已经检查了这个问题:因为它与我的问题相当接近,但并不详尽,所以提出了一个新问题

我有一份由我所在组织的另一名成员与我共享的列表,我可以通过浏览器打开并访问该列表

假设URL是:https://365.sharepoint.com/teams/IC/Lists/Cult%20Tracker/Allitemsg.aspx#InplviewHash7c06d6bd-0344-43fd-8057-ffc7deeec3f7=ShowInGrid%3DTrue

现在我正试图通过python提取这些数据,并对其进行一些分析。 因此,我尝试了“sharepoint”和“Office365 REST Python客户端”软件包,但两个软件包都不起作用,并不断抛出403

我尝试过的代码是:

from sharepoint import SharePointSite, basic_auth_opener

server_url = "https://<host>365.sharepoint.com/"
site_url = server_url + "teams/IC"

opener = basic_auth_opener(server_url, "slaik@<host>.com", "Abcdefgh")
# also tried domain/slaik as userid

site = SharePointSite(site_url, opener)

for sp_list in site.lists:
    print(sp_list.id, sp_list.meta['Title'])
我指的是医生: 不知道我错过了什么


感谢您通读这篇长篇描述以及您可以提供的任何帮助。

您需要使用站点id

换句话说,您的URI应该是

https://graph.microsoft.com/v1.0/sites/host>365.sharepoint.com,fec353b1-bd1a-4569-acd9-6421737b81d6,5b449746-eaae-4941-b044-ef9703a6b2ee/lists

您需要使用站点id

换句话说,您的URI应该是

https://graph.microsoft.com/v1.0/sites/host>365.sharepoint.com,fec353b1-bd1a-4569-acd9-6421737b81d6,5b449746-eaae-4941-b044-ef9703a6b2ee/lists

我收到sharepoint共享链接,只需输入密码即可访问。如何通过API访问此数据?有可能吗?从共享链接访问数据?我收到sharepoint共享链接,只需输入密码即可访问。如何通过API访问此数据?有可能吗?从共享链接访问数据?
An error occurred while retrieving token: AADSTS50126: Invalid username or password.
An error occurred while retrieving auth cookies
Traceback (most recent call last):
  File "C:/Users/slaik/OneDrive - <host>/Migrated from My PC/Documents/Sandeep/Scripts/Python/PycharmProjects/IC_KPI_Report/sharepoint_conect.py", line 30, in <module>
    data = request.execute_request_direct(options)
  File "C:\Users\slaik\OneDrive - <host>\Migrated from My PC\Documents\Sandeep\Scripts\Python\PycharmProjects\IC_KPI_Report\venv\lib\site-packages\office365\runtime\client_request.py", line 104, in execute_request_direct
    self.context.authenticate_request(request_options)
  File "C:\Users\slaik\OneDrive - <host>\Migrated from My PC\Documents\Sandeep\Scripts\Python\PycharmProjects\IC_KPI_Report\venv\lib\site-packages\office365\runtime\auth\authentication_context.py", line 35, in authenticate_request
    request_options.set_header('Cookie', self.provider.get_authentication_cookie())
  File "C:\Users\slaik\OneDrive - <host>\Migrated from My PC\Documents\Sandeep\Scripts\Python\PycharmProjects\IC_KPI_Report\venv\lib\site-packages\office365\runtime\auth\saml_token_provider.py", line 69, in get_authentication_cookie
    return 'FedAuth=' + self.FedAuth + '; rtFa=' + self.rtFa
TypeError: must be str, not NoneType
{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites",
    "value": [
        {
            "createdDateTime": "2017-05-26T14:04:29Z",
            "id": "<host>365.sharepoint.com,fec353b1-bd1a-4569-acd9-6421737b81d6,5b449746-eaae-4941-b044-ef9703a6b2ee",
            "lastModifiedDateTime": "0001-01-01T08:00:00Z",
            "name": "IC",
            "webUrl": "https://<host>365.sharepoint.com/teams/IC",
            "displayName": "IC Division - MRC",
            "root": {},
            "siteCollection": {
                "hostname": "<host>365.sharepoint.com"
            }
        }
    ]
}
{
    "error": {
        "code": "invalidRequest",
        "message": "Invalid hostname for this tenancy",
        "innerError": {
            "request-id": "ab43af0a-6be0-4a40-91ab-5a4ff52bc261",
            "date": "2019-10-17T14:05:52"
        }
    }
}
GET /sites/{site-id}
https://graph.microsoft.com/v1.0/sites/host>365.sharepoint.com,fec353b1-bd1a-4569-acd9-6421737b81d6,5b449746-eaae-4941-b044-ef9703a6b2ee/lists