duan246558
2016-06-07 16:05
浏览 43
已采纳

是否可以使用Office 365在线打开存储在Azure上的文档?

I am copying files using PHP onto an Azure service. Is it possible to produce a link that will allow a user to automatically open this stored document using Office 365 online? Currently, the return URL downloads the stored document to a users local storage. Here is my PHP code which uses the Microsoft Azure PHP SDK.

require_once 'vendor/autoload.php';

use WindowsAzure\Common\ServicesBuilder;
use MicrosoftAzure\Storage\Common\ServiceException;

// Create blob REST proxy.
$connectionString="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$blobRestProxy = ServicesBuilder::getInstance()->createBlobService($connectionString);


$content = fopen("demo.doc", "r");
$blob_name = "demo.doc";

try {
//Upload blob
$blobRestProxy->createBlockBlob("mycontainer", $blob_name, $content);
 }
catch(ServiceException $e){
// Handle exception based on error codes and messages.
// Error codes and messages are here:
// http://msdn.microsoft.com/library/azure/dd179439.aspx
$code = $e->getCode();
$error_message = $e->getMessage();
echo $code.": ".$error_message."<br />";
 }

图片转代码服务由CSDN问答提供 功能建议

我正在使用PHP将文件复制到Azure服务上。 是否可以生成一个链接,允许用户使用Office 365在线自动打开此存储的文档? 目前,返回URL将存储的文档下载到用户本地存储。 这是我的PHP代码,它使用Microsoft Azure PHP SDK。

  require_once'porpers / autoload.php'; 
 
use WindowsAzure \ Common \ ServicesBuilder; 
use MicrosoftAzure \  Storage \ Common \ ServiceException; 
 
 //创建blob REST代理。
 $ connectionString =“xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”; 
 $ blobRestProxy = ServicesBuilder :: getInstance() - &gt; createBlobService($ connectionString); 
 
  
 $ content = fopen(“demo.doc”,“r”); 
 $ blob_name =“demo.doc”; 
 
try {
 //上传blob 
 $ blobRestProxy-&gt; createBlockBlob(“  mycontainer“,$ blob_name,$ content); 
} 
catch(ServiceException $ e){
 // //根据错误代码和消息处理异常。
 //错误代码和消息在这里:
 // http  ://msdn.microsoft.com/library/azure/dd179439.aspx 
 $ code = $ e-&gt; getCode(); 
 $ error_message = $ e-&gt; getMessage(); 
echo $ code。“  :“。$ error_message。”&lt; br /&gt;“; 
} 
   
 
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题