I have a scenario where the user's open PowerPoint presentation needs to be modified by a custom solution. I'm looking at using a PowerPoint web add-in in conjunction with the Graph API's support for OneDrive/SharePoint files.
However, PowerPoint has nothing specifically available in the JavaScript for Office API yet for replacing the contents of the actively edited presentation. As a proof of concept, I've tried using Graph to overwrite a specific PowerPoint file in OneDrive using the upload command, but it throws an error because the file is open in PowerPoint for Windows:
Status Code: 423 Microsoft.Graph.ServiceException: Code: resourceLocked
Message: The resource you are attempting to access is locked
Inner error: AdditionalData:
date: 2020-10-05T21:06:53
request-id: 5e3c2604-382d-4139-a433-8b95ef4f619e
client-request-id: 5e3c2604-382d-4139-a433-8b95ef4f619e
ClientRequestId: 5e3c2604-382d-4139-a433-8b95ef4f619e
I note that if I open that same file in PowerPoint Online, the sharing icon indicator triggers and I'm able to make changes in either editor that are nearly immediately updated in the other editor. So a protocol exists for making live changes. I'm guessing this is through WOPI??. Is there another Graph method available I can use that can support this scenario? Or do I have to build a full WOPI client and/or server solution to do this (which looks insane, if it's possible)?
upload
API end point in OneDrive using something likepython-pptx
to edit the file and update it? How would changes you make in PowerPoint Web update automatically without anotherdownload
REST API call from One Drive? – Minoru