我需要使用谷歌格式将图像上传到Google文档中,以便将其检索回来并保存存储空间。在我的代码示例下面,它工作正常,但最近破了,我只得到一个空文档。有谁可以帮助我?
DocsService client = new DocsService("testappv1");
client.setUserCredentials(username, password);
client.setProtocolVersion(DocsService.Versions.V2);
File file = new File("C:/test.jpg");
DocumentEntry newDocument = new DocumentEntry();
newDocument.setTitle(new PlainTextConstruct("test"));
String mimeType = DocumentListEntry.MediaType.fromFileName(file.getName()).getMimeType();
newDocument.setMediaSource(new MediaFileSource(file, mimeType));
newDocument = client.insert(destFolderUrl, newDocument);
答案 0 :(得分:1)