gpt4 book ai didi

onedrive - 如何重定向到文件选择器

转载 作者:行者123 更新时间:2023-12-02 19:33:45 26 4
gpt4 key购买 nike

我是 skydrive 的新生。然后我想在html中使用文件选择器,并从Interactive Live SDK复制演示代码。但运行结果,打开的窗口并没有直接到文件选择器页面,只是直接到我设置的redirect_uri页面。那么我的演示页面有什么问题吗?谢谢

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

<script type="text/JavaScript">
<!--

/////////////////////////////
WL.init({ client_id: '$my appID', redirect_uri: 'http://www.learnyouwant.com' });

WL.ui({
name: "skydrivepicker",
element: "downloadFile_div",
mode: "open",
select: "multi",
onselected: onDownloadFileCompleted,
onerror: onDownloadFileError
});

WL.login({ "scope": "wl.skydrive wl.signin" }).then(
function(response) {
openFromSkyDrive();
},
function(response) {
log("Failed to authenticate.");
}
);

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.name);
WL.download({ "path": file.id + "/content" });
}
},
function(errorResponse) {
log("WL.fileDialog errorResponse = " + JSON.stringify(errorResponse));
}
);
}

function log(message) {
var child = document.createTextNode(message);
var parent = document.getElementById('JsOutputDiv') || document.body;
parent.appendChild(child);
parent.appendChild(document.createElement("br"));
}

function onDownloadFileCompleted(response) {
var msg = "";
// For each folder selected...
if (response.data.folders.length > 0) {
for (folder = 0; folder < response.data.folders.length; folder++) {
// Use folder IDs to iterate through child folders and files as needed.
msg += "\n" + response.data.folders[folder].id;
}
}
// For each file selected...
if (response.data.files.length > 0) {
for (file = 0; file < response.data.files.length; file++) {
// Use file IDs to iterate through files as needed.
msg += "\n" + response.data.files[file].id;
}
}
log(msg);
};

function onDownloadFileError(responseFailed) {
log(responseFailed.error.message);
}

//-->
</script>

最佳答案

我找到原因了。其中redirect_uri必须与应用注册时填写的一致。

关于onedrive - 如何重定向到文件选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15140745/

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