Reputation: 422
I am using the OneDrive API as file storage in a CRM and I have been asked if clicking on a file in the CRM can open it directly in Office Online to be edited, rather than people having to download the file, edit on their desktop, the re-upload.
I can't find anything in the documentation either way so maybe my Google-fu is low at the moment
Upvotes: 1
Views: 1402
Reputation: 33094
The DriveItem property you're looking for is called webUrl
.For Office documents (Word, Excel, PowerPoint, etc.), webUrl
contains the complete link to opening the document in Office Online:
{
"id": "{driveItem-id}",
"name": "{file-name}",
"file": {
"hashes": {
"quickXorHash": "YY1FIiSDCS9hcAptSPs7prNdf5A="
},
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
},
"size": 22750,
"webUrl": "https://{domain}/{path}/_layouts/WopiFrame.aspx?sourcedoc{id}&file={file-name}&action=default",
}
If the user also has a native Office client installed (Office for Windows, Mac, iPad, etc.), they will also be presented with the option to open the document in the native app (which will also automatically handle saving changes directly back to OneDrive).
You can try this for yourself using this sample in Graph Explorer.
Upvotes: 1
Reputation: 422
For those others with low GoogleFu right now. When you get an items information from the API, its listed in there.
For more info the best term i found to search for was "wopiFrame" its part of the URL and so has some very relevant search results.
Upvotes: 0