繁体   English   中英

将数据从 JSON 上传到 Sharepoint 列表与 Microsoft Graph API in ZA7F5F35426B92748117363

[英]Uppload data from JSON to Sharepoint List with Microsoft Graph API in Python

我正在尝试从与目标 SharePoint 列表具有相同结构的 JSON 文件中添加一些数据。 我之前检查过我是否可以使用 get 方法访问该列表,并且我可以进行身份验证并获取令牌。 问题是我似乎无法弄清楚如何正确上传数据。

下面是我的简化代码

URL= 'https://graph.microsoft.com/vx.x/sites/sharepointname/sites/group/lists/listId/rows/add'
json_file = a pandas file converted to json

post_data = requests.post( URL,
            headers={'Authorization': 'Bearer ' + token['access_token'], 'Content-Type': 'application/json'},
            data = json_file
            )

这不起作用,我得到的一些错误是“找不到段\uxxxrows\uxxx的资源”。 如果有任何帮助,我将不胜感激。

我想你可能弄错了 URL。 这将解释您遇到Resource not found for the segment...错误。

如果您尝试创建一个新列表, 这里是文档
URL - POST https://graph.microsoft.com/v1.0/sites/{site-id}/lists

如果您尝试将项目添加到现有列表, 这里是文档
URL - POST https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM