/range option for graph API 访问 Sharepoint 上的 excel 文件(使用 table)导致 400 响应
/range option for graph API accessing a excel file on Sharepoint (with table) results in 400 response
自 2022 年 1 月 29 日起,以下获取请求导致 400 响应
v1.0/sites/{site_id}/drives/{drive_id}/items/{doc_id}/workbook/worksheets/Sheet1/tables/{table_name}/range
而
v1.0/sites/{site_id}/drives/{drive_id}/items/{doc_id}/workbook/worksheets/Sheet1/tables/{table_name}
v1.0/sites/{site_id}/drives/{drive_id}/items/{doc_id}/workbook/worksheets/Sheet1/tables/{table_name}/rows
导致 200 响应。
http headers 负载准确(授权、内容类型)
这是我的python代码
注意:以下(及以上)代码 - 敏感信息已被编辑。
import requests
url = 'https://graph.microsoft.com/v1.0/sites/{organization share point site}/drives/{drive-id}/items/{document-id}/workbook/worksheets/Sheet1/tables/{table name}/range'
print (url)
http_headers = {'Authorization': 'Bearer {my key}', 'Accept': 'application/json', 'Content-Type': 'application/json', 'Cache-Control': 'no-cache', 'verify' : 'True'}
x = requests.get(url=url,headers=http_headers,stream=False)
print(x.status_code)
如果您的 table 太大,您可能会收到响应状态 400,并出现以下错误
{
"error": {
"code": "ResponsePayloadSizeLimitExceeded",
"message": "The size of the payload exceeded the limit. Read the documentation: https://docs.microsoft.com/office/dev/add-ins/concepts/resource-limits-and-performance-optimization#excel-add-ins.",
"innerError": {
"code": "responsePayloadSizeLimitExceeded",
"message": "The size of the payload exceeded the limit. Read the documentation: https://docs.microsoft.com/office/dev/add-ins/concepts/resource-limits-and-performance-optimization#excel-add-ins.",
"date": "2022-02-01T12:38:03",
"request-id": "cae21c5d-8a48-4a22-ad4d-8994de9325ef",
"client-request-id": "7a46b35e-7f15-1d22-75c3-dd867d0d48b5"
}
}
}
自 2022 年 1 月 29 日起,以下获取请求导致 400 响应
v1.0/sites/{site_id}/drives/{drive_id}/items/{doc_id}/workbook/worksheets/Sheet1/tables/{table_name}/range
而
v1.0/sites/{site_id}/drives/{drive_id}/items/{doc_id}/workbook/worksheets/Sheet1/tables/{table_name}
v1.0/sites/{site_id}/drives/{drive_id}/items/{doc_id}/workbook/worksheets/Sheet1/tables/{table_name}/rows
导致 200 响应。
http headers 负载准确(授权、内容类型)
这是我的python代码
注意:以下(及以上)代码 - 敏感信息已被编辑。
import requests
url = 'https://graph.microsoft.com/v1.0/sites/{organization share point site}/drives/{drive-id}/items/{document-id}/workbook/worksheets/Sheet1/tables/{table name}/range'
print (url)
http_headers = {'Authorization': 'Bearer {my key}', 'Accept': 'application/json', 'Content-Type': 'application/json', 'Cache-Control': 'no-cache', 'verify' : 'True'}
x = requests.get(url=url,headers=http_headers,stream=False)
print(x.status_code)
如果您的 table 太大,您可能会收到响应状态 400,并出现以下错误
{
"error": {
"code": "ResponsePayloadSizeLimitExceeded",
"message": "The size of the payload exceeded the limit. Read the documentation: https://docs.microsoft.com/office/dev/add-ins/concepts/resource-limits-and-performance-optimization#excel-add-ins.",
"innerError": {
"code": "responsePayloadSizeLimitExceeded",
"message": "The size of the payload exceeded the limit. Read the documentation: https://docs.microsoft.com/office/dev/add-ins/concepts/resource-limits-and-performance-optimization#excel-add-ins.",
"date": "2022-02-01T12:38:03",
"request-id": "cae21c5d-8a48-4a22-ad4d-8994de9325ef",
"client-request-id": "7a46b35e-7f15-1d22-75c3-dd867d0d48b5"
}
}
}