如何使用Google API查找Uploaded Doc的文件ID

时间:2014-10-21 05:56:25

标签: java google-sheets google-drive-api google-docs-api

以下是我用于使用Java上传文件的代码。

文件上传,但我想知道上传文件的文件ID?

URL feedUrl = new URL("https://docs.google.com/feeds/default/private/full/");

DocsService docService = new DocsService("Doc");
docService.setUserCredentials("email@gmail.com","password");

DocumentListEntry uploadFile = new DocumentListEntry();
uploadFile.setTitle(new PlainTextConstruct("FileName"));
uploadFile.setFile(new File("/path/test.csv"), "text/plain");
uploadFile = docService.insert(feedUrl, uploadFile);

如何查找上传文件的文件ID?

我想上传一份doc&使用Google API分享。

1 个答案:

答案 0 :(得分:0)

根据this,它在

uploadFile.getDocId()