Onedrive api 如何附加文件而不是下载

Onedrive api how to attach files rather than downloading?

本文关键字:下载 文件 api 何附加 Onedrive      更新时间:2023-09-26

我关注了交互式实时sdk并将其添加到我的HTML页面中。

此外,我已经成功添加了回调.html页面,我在其中成功获取文件选取器对话框。一旦我从文件对话框中选择文件,它就会被下载,由于WL.download功能,我理解了这一点。

但我想要的只是附加文件而不是下载它。 如何在交互式实时SDK中更改JavaScript

有什么建议吗?

对此感到抱歉。 您可以使用"源"或"链接"来完成此操作。 在"使用从 OneDrive 选取器打开"的 ISDK 上,更改以下代码片段的代码(我在下面使用了"file.link")。 "输出"框应该让你了解如果将链接包含在应用中,链接将是什么。 当然,您需要删除"WL.download"功能,以便它不会下载文件并将 file.link 或file.source添加到代码中的某个位置,而不是像ISDK那样记录它。

function openFromSkyDrive() {
    WL.fileDialog({
        mode: 'open',
        select: 'single'
    }).then(
        function(response) {
            log("The following file is being downloaded:");
            log("");
            var files = response.data.files;
            for (var i = 0; i < files.length; i++) {
                var file = files[i];
                log(file.link);
                WL.download({ "path": file.id + "/content" });
            }
        },
        function(errorResponse) {
            log("WL.fileDialog errorResponse = " + JSON.stringify(errorResponse));
        }
    );
}

在 ISDK (http://isdk.dev.live.com) 中,你需要尝试使用"使用保存到 OneDrive 选取器"。 您会注意到 WL.fileDialog 设置为 ({ 模式: 'save' }) 并调用了 WL.upload 函数。 我希望这有所帮助。