gpt4 book ai didi

android - 如何从sky drive中获取文件名并显示在列表中

转载 作者:行者123 更新时间:2023-11-30 02:41:12 25 4
gpt4 key购买 nike

我正在构建 Skydrive 应用程序,我想在列表中显示所有主目录(根文件夹)文件。我已成功登录,但我不知道如何从我的 Skydrive 帐户的主目录中获取所有文件名

最佳答案

听起来好像使用适用于 Android 的 LiveSDK 可以让您从 OneDrive 获得所需的详细信息,https://github.com/liveservices/LiveSDK-for-Android/

这是一个有限的示例,它将为您从 OneDrive 的根目录中获取项目名称和类型:

mClient = (LiveConnectClient) mApp.getConnectClient();
mClient.getAsync("me/skydrive/files", new LiveOperationListener() {
@Override
public void onComplete(final LiveOperation operation) {
final JSONObject result = operation.getResult();
if (result.has("error")) {
final JSONObject error = result.optJSONObject("error");
final String message = error.optString("message");
final String code = error.optString("code");
showToast(code + ": " + message);
return;
}

final JSONArray data = result.optJSONArray("data");
for (int i = 0; i < data.length(); i++) {
final JSONObject oneDriveItem = data.optJSONObject(i);
if (oneDriveItem != null) {
final String itemName = oneDriveItem.optString("name");
final String itemType = oneDriveItem.optString("type");
// Update your adapter with the contents of the folder
}
}
}
});

可以看到这个例子的来源https://github.com/liveservices/LiveSDK-for-Android/blob/master/sample/src/com/microsoft/live/sample/skydrive/SkyDriveActivity.java#L759我强烈建议您使用此示例应用程序,以了解 LiveSDK 的可能性。

关于android - 如何从sky drive中获取文件名并显示在列表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25733976/

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