0

How can I open the document (.docx) in editable format ? When I upload the doc file it will successfully viewed in drive of microsoft business account?

$uri ='https://graph.microsoft.com/v1.0/me/drive/root:/roshan.docx:/content';
$headers = array( 'Content-Type: application/text', "Cache-Control: no- cache", "Pragma: no-cache", "Authorization: bearer ".$pppp ); 
$output = "";
$pointer = fopen($filpath, 'r+');
$stat = fstat($pointer);
$pointersize = $stat['size'];
$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_INFILE, $pointer);
curl_setopt($ch, CURLOPT_INFILESIZE, (int) $pointersize);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
$output = curl_exec($ch);
$output = json_decode($output, true);
Al Foиce ѫ
  • 4,195
  • 12
  • 39
  • 49

1 Answers1

0

Google Chrome has a free Extension, Office Editing for Docs, Sheets, and Slides.

This extension allows you to open MS .docx files within Drive and edit them without needing to convert them first.

If you want to use Graph API and programmatically open from a web app, you can take a look at this thread which covers how to do this. How to programmatically open a file located in OneDrive using desktop Word?

Marilee Turscak - MSFT
  • 7,367
  • 3
  • 18
  • 28