是否可以使用 Office 365 在线打开存储在 Azure 上的文档?
Is it possible to open a document stored on Azure with Office 365 online?
我正在使用 PHP 将文件复制到 Azure 服务上。是否可以生成一个 link 允许用户使用 Office 365 在线自动打开此存储的文档?当前,return URL 将存储的文档下载到用户本地存储。这是我的 PHP 代码,它使用 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 />";
}
默认情况下,Office 365 无法打开存储在其他位置(不在 Office 365 中)的文件。但是,您可以尝试使用 WOPI 协议与 Office Online 集成。 WOPI 协议使 Office Online 能够访问和更改存储在您的服务中的文件。
另一种解决方法是,您可以考虑将文件上传到 Office 365。您可以参考下面的 REST 将 create/upload 项目上传到 SharePoint 在线:
POST: https://graph.microsoft.com/v1.0/me/drive/root/children
authorization: bearer {token}
content-type: application/json
{
"name":"filename.docx",
"file":{}
}
PUT: https://graph.microsoft.com/v1.0/me/drive/root:/RESTFei.docx:/content
authorization: bearer {token}
Content-Type: application/msword
<@INCLUDE *C:\Users\username \Desktop\test.docx*@>
有关使用 Microsoft Graph 进行开发的更多详细信息,请参阅 here。
我正在使用 PHP 将文件复制到 Azure 服务上。是否可以生成一个 link 允许用户使用 Office 365 在线自动打开此存储的文档?当前,return URL 将存储的文档下载到用户本地存储。这是我的 PHP 代码,它使用 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 />";
}
默认情况下,Office 365 无法打开存储在其他位置(不在 Office 365 中)的文件。但是,您可以尝试使用 WOPI 协议与 Office Online 集成。 WOPI 协议使 Office Online 能够访问和更改存储在您的服务中的文件。
另一种解决方法是,您可以考虑将文件上传到 Office 365。您可以参考下面的 REST 将 create/upload 项目上传到 SharePoint 在线:
POST: https://graph.microsoft.com/v1.0/me/drive/root/children
authorization: bearer {token}
content-type: application/json
{
"name":"filename.docx",
"file":{}
}
PUT: https://graph.microsoft.com/v1.0/me/drive/root:/RESTFei.docx:/content
authorization: bearer {token}
Content-Type: application/msword
<@INCLUDE *C:\Users\username \Desktop\test.docx*@>
有关使用 Microsoft Graph 进行开发的更多详细信息,请参阅 here。