2012-04-16 7 views
1

は私のコード失敗は以下

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); 

であるJava APIを経由してGoogleドキュメントに画像ファイルをアップロードする文書が成功した作成されましたが、それは何も含まれていませんでした。

+0

に働くだろうかということどのように私はその前提と必ず、重要ではないと思い、次の

client.insert(new URL("https://docs.google.com/feeds/documents/private/full/?convert=false"), newDocument); 

を試してみてください空のテキスト文書が作成されていますか?これが欲しいですか?またはアップロードしたファイルを普通の画像にしたいですか? – Jacxel

+0

イメージを含むgoogle-doc形式のドキュメントを作成します。ちょうど私がgoogle-docにイメージファイルを直接ドラッグするのと同じように。 Googleのdoc設定で – user1335794

答えて

3

私は?convert=falseビットを使用すると、URLなし

client.insert(new URL(destFolderUrl+ "?convert=false"), newDocument); 

がうまくいけば、あなたのケース

+0

、私はGoogle形式に変換文書を設定します。 URLの後に "convert = false"を追加すると、エラーが発生します。 'URL destFolderUrl =新しいURL(" https://docs.google.com/feeds/folders/private/full/folderResourceId?convert=false ");' – user1335794

+0

私はあなたの問題だと思っています。そのときにjpegを変換しようとしています方法を知らない、あなたはする必要はありません。 – Jacxel

+0

どんな摂取ですか?それは正常に動作していた、ちょうど最近この問題があります。 – user1335794

関連する問題