Hello,
I opened a workbook in OneDrive and want to insert and update rows to it via the app. I was able to progress smoothly in getting and adding rows. But updating row data is not working.
I was able to update using Graph Explorer. I sent the sample request as HTTP method Patch.
PATCH https://graph.microsoft.com/v1.0/users/{userId}/drive/items/{itemId}/workbook/tables/{tableName}/rows/itemAt(index=2)
Content-type: application/json
{
"values": "values-value"
}
I noticed 2 different things when I tried in java.
First, when I give the row index, the patch method appears. I get an error when I use the update method written in the Graph Api document. It gets ApiNotFound error.
Doc : https://learn.microsoft.com/en-us/graph/api/tablerow-update?view=graph-rest-1.0&tabs=java
graphClient.users(oneDriveProperties.getUserId())
.drive()
.items(oneDriveProperties.getWorkbookId())
.workbook()
.tables(oneDriveProperties.getWorkbookTableName())
.rows(String.valueOf(rowIndex))
.buildRequest()
.patch(workbookTableRow);
ERROR:
{
"error": {
"code": "ApiNotFound",
"message": "Kullanmaya çalıştığınız API bulunamadı. Excel’in daha yeni bir versiyonunda mevcut olabilir. Lütfen şu belgeye başvurun: \"https://docs.microsoft.com/office/dev/add-ins/reference/requirement-sets/excel-api-requirement-sets\".",
"innerError": {
"code": "apiNotFound",
"message": "Kullanmaya çalıştığınız API bulunamadı. Excel’in daha yeni bir versiyonunda mevcut olabilir. Lütfen şu belgeye başvurun: \"https://docs.microsoft.com/office/dev/add-ins/reference/requirement-sets/excel-api-requirement-sets\".",
"date": "2023-02-28T20:00:33",
"request-id": "
"client-request-id": "***"
}
}
}
Secondly, when I want to transfer the successful request in explorer to the code, the patch method does not appear. There is no patch method for update with item at parameter.
graphClient.users(oneDriveProperties.getUserId())
.drive()
.items(oneDriveProperties.getWorkbookId())
.workbook()
.tables(oneDriveProperties.getWorkbookTableName())
.rows()
.itemAt(WorkbookTableRowItemAtParameterSet.newBuilder().withIndex(rowIndex).build())
.buildRequest();
// .send(HttpMethod.PATCH, workbookTableRow);
// .patch(workbookTableRow);
How can I update this row data? How can I update even by giving range?