如何在任务窗格应用程序中使用 OfficeJs 获取文档共享 link?

How to get document share link using OfficeJs in a task pane app?

目前是否可以为打开的文档获取共享 link(仅查看或编辑)?我想知道发送 link 或添加其他用户的任务是否可以使用预定逻辑从 javascript 自动化。

查看 document.getFilePropertiesAsync 方法。

结果对象将包含文件 url(如果存在)。

function getFileUrl() {
    //Get the URL of the current file.
    Office.context.document.getFilePropertiesAsync(function (asyncResult) {
        var fileUrl = asyncResult.value.url;
        if (fileUrl == "") {
            showMessage("The file hasn't been saved yet. Save the file and try again");
        }
        else {
            showMessage(fileUrl);
        }
    });
}