将一个驱动器与 Visual Studio Lightswitch HTML 2013 配合使用

Using One Drive with Visual Studio Lightswitch HTML 2013

本文关键字:2013 HTML Lightswitch Studio Visual 一个 驱动器      更新时间:2023-09-26

我目前正在尝试学习如何通过javascript访问一个驱动器文件夹,但是有一个主要概念让我感到困惑:

我创建了一个名为test的文件夹,其名称如下:

folder.a6b2a7e8f2515e5e.A6B2A7E8F2515E5E!164

现在使用 Microsoft 提供的这段代码,有没有办法只使用"测试"这个词而不是这么长的代码? 我的理由是这不是用户友好的,不容易设置......否则我将不得不将每个名称存储在数据库中,而不是引用项目名称?

function readFolderProperties_onClick() {
    WL.login({
        scope: "wl.skydrive"
    }).then(
        function (response) {
            WL.api({
                path: "folder.a6b2a7e8f2515e5e.A6B2A7E8F2515E5E!164",
                method: "GET"
            }).then(
                function (response) {
                    document.getElementById("infoArea").innerText = 
                        "Folder properties: name = " + response.name + ", ID = " + response.id;                
                }, 
                function (responseFailed) {
                    document.getElementById("infoArea").innerText = 
                        "Error reading folder properties: " + responseFailed.error.message;
                }
            );
        }, 
        function (responseFailed) {
            document.getElementById("infoArea").innerText = 
                "Error signing in: " + responseFailed.error_description;
        }
    );
}

https://msdn.microsoft.com/en-gb/library/hh826531.aspx

感谢您对此的任何帮助

如下面的 MSDN 文章所述,友好名称只能在某些情况下使用:

从应用访问 OneDrive Microsoft常见任务(在"使用友好名称访问某些 OneDrive 文件夹"部分下)

但是,如以下 MSDN 文章和堆栈溢出帖子中所述,可以使用更新的 OneDrive API,这可能会有所帮助:

实时 SDK(在"新增功能"部分下)

上传到my_documents或my_photos文件夹 OneDrive

更具体地说,下面详细介绍了此新 API 通过友好路径寻址资源的方法:

对 OneDrive 上的驱动器中的资源进行寻址(在"基于路径的寻址"部分下)