“找不到DriveId。您有权查看此文件吗?“:即使手动设置了EXISTING_FOLDER_ID [英] "Cannot find DriveId. Are you authorized to view this file?": Even if EXISTING_FOLDER_ID is set manually
问题描述
我正在看github的这里。
我可以通过阅读github中提供的代码来成功创建文件和文件夹。但我无法编辑文件或在任何特定文件夹中创建文件/文件夹。
主要问题是使用模拟器,但我是不确定。我使用的是GenyMotion
我还使用
<$ p复制了文件/文件夹的ID $ p $ showMessage(在App文件夹中创建一个文件:
+ result.getDriveFile()。getDriveId());
和
showMessage(Created a folder:+ result.getDriveFolder()。getDriveId());
代码行。
然后我改变了 public static final String EXISTING_FOLDER_ID =CAESABjACiCShczj8lI =; //改变了这个
public static final String EXISTING_FILE_ID =0ByfSjdPVs9MZTHBmMVdSeWxaNTg;
的BaseActivity。仍然收到相同的输出。
找不到DriveId。您有权查看此文件吗?
任何人都可以指出我在这里做错了什么?
谢谢!!
顺便说一句。您的问题的最短答案是:
result.getDriveFile()。getDriveId()。getResourceId();
但是如果你太快看到 SO 22874657 。
祝您好运。
I am having a look at here from github.
I can create a file and a folder successfully by reading the code provided in github. But I am not being able to edit the file or create a file/folder in any specific folder.
The main problem would be using emulator, but I am not sure. I am using GenyMotion
I have also copied the ID of a file/folder using
showMessage("Created a file in App Folder: "
+ result.getDriveFile().getDriveId());
and
showMessage("Created a folder: " + result.getDriveFolder().getDriveId());
lines of code .
Then I changed
public static final String EXISTING_FOLDER_ID = "CAESABjACiCShczj8lI=";//changed this
public static final String EXISTING_FILE_ID = "0ByfSjdPVs9MZTHBmMVdSeWxaNTg";
of BaseActivity. Still I am getting the same output.
"Cannot find DriveId. Are you authorized to view this file?"
Can anyone point me what am I doing wrong here?
Thank you!!
I do believe that 'result.getDriveFile().getDriveId()' gives you a 'DriveId', an ID used by GDAA only. The 'EXISTING_FILE_ID' refers to another ID, so called ResourceID. You have to use that one. See SO 21800257. The ResourceId is the original ID used in older RESTful API, and the only one that you can use when referring to the Drive object across different devices (DriveID is device specific). ResourceID can also be seen as a part of the URL address of the object.
BTW. the shortest answer to your question is:
result.getDriveFile().getDriveId().getResourceId();
But you may get NULL if you're too quick see SO 22874657 .
Good Luck.
这篇关于“找不到DriveId。您有权查看此文件吗?“:即使手动设置了EXISTING_FOLDER_ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!