如何解决从Google驱动器获取共享驱动器列表
我正在尝试从Google驱动器获取共享驱动器列表,并检查返回的驱动器列表中是否存在驱动器。
am使用http方法 https://www.googleapis.com/drive/v3/drives
这使我返回到输出以下。
{
"kind": "drive#driveList","drives": [
{
"kind": "drive#drive","id": "0AKrgo4Gdm2hzUk9PVA","name": "Dev"
}]
}
需要检查驱动器“ Dev”是否存在。如果是,我需要其ID作为输出。如果未找到“未找到”。
能够通过http连接实现此目的。如何通过Java方法实现这一目标?
正在尝试的代码如下:
public static String driveName(String driveName,String oauthToken){
String driveId = null;
File file = null;
GoogleCredential credential = new GoogleCredential();
credential.setAccessToken(oauthToken);
_teamdrives = new Drive.Builder(GoogleNetHttpTransport.newTrustedTransport(),JacksonFactory.getDefaultInstance(),credential).setApplicationName("mulesoftgdrive").build();
file = _teamdrives.drives().get(driveId).execute();
return driveId;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。