简体   繁体   中英

Using One Drive with Visual Studio Lightswitch HTML 2013

I am currently trying to learn how to access a one drive folder via javascript however there is one main concept which is confusing me:

I create a folder called test which has the name of something like this:

folder.a6b2a7e8f2515e5e.A6B2A7E8F2515E5E!164

now using this code provided by Microsoft, is there a way to just use the word "Test" rather than this long code? my reason being this is not user friendly and cannot easily be set up... otherwise I shall have to store each name in a database rather than referring to say a project name?

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

thanks for any help on this

As covered in the following MSDN article, friendly names can only be used in certain situations:

Common tasks in accessing Microsoft OneDrive from your app (under the 'Using friendly names to access certain OneDrive folders' section)

However, as mentioned in the following MSDN article and stackoverflow post, a newer OneDrive API is available which may help:

The Live SDK (under the 'What's new' section)

Upload to my_documents or my_photos folder OneDrive

More specifically, the following details this new API's approach to addressing resources by a friendly path:

Addressing resources in a drive on OneDrive (under the 'Path-based addressing' section)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM