1
votes

Is it possible to open an WORD/EXCEL/POWERPOINT document in an external application to edit it and subscribes to an callback when the document is successfully saved?

Through the Microsoft Graph API you can read from your SHAREPOINT docs but i want to implement a "edit online" button. It should redirect or open an popup to the online viewer in edit mode. i've couldn't find anything (only an example for generating an excel document and save it to one drive)

1

1 Answers

0
votes

The webUrl property of a DriveItem holds a link for opening a document the associated online editor (or native app if one is installed).

This is an example DriveItem from Graph Explorer:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('48d31887-5fad-4d73-a9f5-3c356e68a038')/drive/items/$entity",
    "@microsoft.graph.downloadUrl": "https://m365x214355-my.sharepoint.com/personal/meganb_m365x214355_onmicrosoft_com/_layouts/15/download.aspx?UniqueId=369dbd4a-9bb6-4357-b067-98601b723004&Translate=false&tempauth=eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvbTM2NXgyMTQzNTUtbXkuc2hhcmVwb2ludC5jb21AZGNkMjE5ZGQtYmM2OC00YjliLWJmMGItNGEzM2E3OTZiZTM1IiwiaXNzIjoiMDAwMDAwMDMtMDAwMC0wZmYxLWNlMDAtMDAwMDAwMDAwMDAwIiwibmJmIjoiMTUyMTcyNzg1MiIsImV4cCI6IjE1MjE3MzE0NTIiLCJlbmRwb2ludHVybCI6IklISHJYbVNERWdXaGRZMGhSYnlyZzA5S2VKbG5KZkZBbThxNEhDV25EcHM9IiwiZW5kcG9pbnR1cmxMZW5ndGgiOiIxNjkiLCJpc2xvb3BiYWNrIjoiVHJ1ZSIsImNpZCI6IllXUTNPVEppWTJNdFlXRTBPUzAwT0RRd0xUazJOMlF0TlRFMFpqazFZbVl4Wm1FMSIsInZlciI6Imhhc2hlZHByb29mdG9rZW4iLCJzaXRlaWQiOiJaRGd5TXpFeVpqa3RZakl6WWkwMFkySmpMVGsxWkRVdE0yVXdaRGswWlRZNFl6RmwiLCJhcHBfZGlzcGxheW5hbWUiOiJhcGlzYW5kYm94cHJveHkiLCJuYW1laWQiOiIwIy5mfG1lbWJlcnNoaXB8bWVnYW5iQG0zNjV4MjE0MzU1Lm9ubWljcm9zb2Z0LmNvbSIsIm5paSI6Im1pY3Jvc29mdC5zaGFyZXBvaW50IiwiaXN1c2VyIjoidHJ1ZSIsImNhY2hla2V5IjoiMGguZnxtZW1iZXJzaGlwfDEwMDNiZmZkYTM4MTMxYWZAbGl2ZS5jb20iLCJ0dCI6IjAiLCJ1c2VQZXJzaXN0ZW50Q29va2llIjpudWxsfQ.SEJSaFNOU3dxajVRSzlyK3RnYUtITWd4SVVqaURjMUl2aHdmYUpRY2diQT0&ApiVersion=2.0",
    "eTag": "\"{369DBD4A-9BB6-4357-B067-98601B723004},6\"",
    "id": "01BYE5RZ2KXWOTNNU3K5B3AZ4YMANXEMAE",
    "name": "Winning ideas.one",
    "webUrl": "https://m365x214355-my.sharepoint.com/personal/meganb_m365x214355_onmicrosoft_com/_layouts/WopiFrame.aspx?sourcedoc=%7B369DBD4A-9BB6-4357-B067-98601B723004%7D&file=Winning%20ideas.one&action=default",
    "cTag": "\"c:{369DBD4A-9BB6-4357-B067-98601B723004},6\"",
    "file":
    {
        "mimeType": "application/msonenote"
    },
    "fileSystemInfo":
    {
        "createdDateTime": "2017-09-15T01:16:07Z",
        "lastModifiedDateTime": "2017-09-15T01:16:14Z"
    },
    "size": 11116
}

The property you're looking for is:

"webUrl": "https://m365x214355-my.sharepoint.com/personal/meganb_m365x214355_onmicrosoft_com/_layouts/WopiFrame.aspx?sourcedoc=%7B369DBD4A-9BB6-4357-B067-98601B723004%7D&file=Winning%20ideas.one&action=default",