0

I have real problem in displaying the content of the folders which are located inside the root directory. It managed to determine the folders which are in the Files directory but when I try to do the same to one of those folders It doesn't work.

I delieve the problem in the path name of a WL.api. However I may be mistaken.

I used code samples from skydrive page of live connect development center. in the sample below I tried to determine folders first, but eventually I would like to get the names of all files stored in a particular directory.

WL.api({ path: "me/skydrive/files/myfolder", method: "get" }).then(
                function (response) {
                    var items = response.data;
                    var outPuts = "";
                    var number = items.length
                    var tempos = new Array();
                    var foundFolder = 0;
                    for (var i = 0; i < items.length; i++) {
                        if (items[i].type === "folder" || items[i].type === "album") {
                            tempos[i] = items[i].name;
                            foundFolder += 1;

                        }
                    }

                    if (foundFolder == 0) {
                        folderss.innerHTML = ("Unable to find any folders");
                    }
                    else {
                        for (var i = 0; i < number; i++) {
                            outPuts = outPuts + tempos[i] + "<br /> <br />"
                        }
                        folderss.innerHTML = outPuts;
                    }

                }
            );

if I retain only "me/skydrive/files" for WL path. it works. But if I add any particular folder name afer it like in my case "me/skydrive/files/myfolder" the call returns nothing. Thank you for anyone who can help.

4

1 回答 1

0

据我所知,要获取非根文件夹的文件列表,您应该使用文件夹 ID 而不是文件夹名称。获取请求应如下所示:folder.Id + "/files"

于 2013-07-03T06:07:41.490 回答