I want to delete the inline embedded images when the id is supplied
I have tried with
Docs.Documents.batchUpdate({requests: [{"deletePositionedObject": {"objectId": "kix.b0ejdj9gt8ia"}}]}, doc.getId());
But this will not delete the images inside
I want to delete the inline embedded images when the id is supplied
I have tried with
Docs.Documents.batchUpdate({requests: [{"deletePositionedObject": {"objectId": "kix.b0ejdj9gt8ia"}}]}, doc.getId());
But this will not delete the images inside
On my replication, the DeletePositionedObjectRequest produces an error as seen below after inserting an embedded image with an objectId:
The DeletePositionedObjectRequest Request:
The Error:
{
"error": {
"code": 400,
"message": "Invalid requests[0].deletePositionedObject: No positioned object with ID: kix.ig5lfhg9lak6",
"status": "INVALID_ARGUMENT"
}
}
This looks like the objectId needed in DeletePositionedObjectRequest is a positioned object & is different from objectId of the inline embedded image.
As an alternative solution, you can use the deleteContentRange instead & adjust it accordingly to your setup.
1. Get the startIndex & endIndex of the embedded inline image on the document.
2. The deleteContentRange request body