gpt4 book ai didi

javascript - 无法访问 skyDrive 文件夹

转载 作者:行者123 更新时间:2023-12-02 19:01:09 24 4
gpt4 key购买 nike

我正在尝试创建一个应用程序,该应用程序将通过 SkyDrive API 访问文件夹及其内容。

但我只能得到我的名字和照片。由于某种未知的原因,文件夹没有被描绘。

代码运行没有错误,只是没有输出。我真的不知道我做错了什么。如果有人有任何建议,我将不胜感激。

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>file Content</title>
<style>

</style>

</head>
<body>
<h1>File Content</h1>
<div>
<div id="meName" class="Name"></div>
<div id="meImg"></div>
<div id="signin"></div>
<div bgcolor='blue' id ="meCount"></div>
</div>


<script src="//js.live.net/v5.0/wl.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript" language="javascript">

// Update the following values
var client_id = "XXXXXXXXXX",
scope = ["wl.signin", "wl.basic", "wl.offline_access", "wl.emails", "wl.skydrive_update"],
redirect_uri = "http://XXXXXXXX/callback.aspx";

function id(domId) {
return document.getElementById(domId);
}

function displayMe() {
var imgHolder = id("meImg"),
nameHolder = id("meName"),
cout = id("meCount");

if (imgHolder.innerHTML != "") return;

if (WL.getSession() != null) {
WL.api({ path: "me/picture", method: "get" }).then(
function (response) {
if (response.location) {
imgHolder.innerHTML = "<img src='" + response.location + "' />";
}
}
);



WL.api({ path: "me", method: "get" }).then(
function (response) {
nameHolder.innerHTML = response.name;
}
);

WL.api({ path: "me/skydrive", method: "get" }).then(
function (response) {
cout.innerHTML = response.count;
}
);


}
}



function clearMe() {
id("meImg").innerHTML = "";
id("meName").innerHTML = "";
}

WL.Event.subscribe("auth.sessionChange",
function (e) {
if (e.session) {
displayMe();
refreshPath ();
}
else {
clearMe();
}
}
);




WL.init({ client_id: client_id, redirect_uri: redirect_uri,
response_type: "code" });

WL.ui({ name: "signin", element: "signin", brand: "skydrive",
type: "Connect", scope: "wl.signin wl.skydrive_update" });



function refreshPath (){
var options = viewerPage.options;

var name = (options && 'name' in options) ?
options.name : 'SkyDrive';
var path = (options && 'path' in options) ?
options.path : 'me/skydrive';

loadPath(name, path);
}

function isFolder (file){
return file.type == 'folder' ||
file.type == 'album';
}

function loadPath(name, path){
updateTitle(name);
clearViewer();

WL.api({path: path + '/files'}, function (response){
if (response.error){
return;
}

var items = response.data.map(function (item) {

return{
group: 'default',
key: item.id,
file: item
};
});

items.sort(function itemA, itemB){
var isFolderA = isFolder(itemA.file);
var isFolderB = isFolder(itemB.file);

if (isFolderA == isFolderB){

return itemA.file.namelocaleCompare(itemB.file.name);
}
else if (isFolderA){
return -1;
}
else{
return 1;
}
});
viewerPage.items = items;
updateList();
});
}




</script>

<script>

</script>
</body>
</html>

最佳答案

您是否尝试过使用 ISDK 上的示例:

http://isdk.dev.live.com

例如以下示例:

http://isdk.dev.live.com/ISDK.aspx?category=scenarioGroup_skyDrive&index=2

还有一个面板,您可以在其中直接调用 Live API 服务以查看它们返回的内容。

关于javascript - 无法访问 skyDrive 文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14784278/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com