hello,Jeff
Thanks very much for your help!
I will trouble you to help me to investigate other quesion:
THANKS VERY MUCH!
When I attempt to upload a spreadsheet file using latest google
client,the following exception occurred:
-----------------------
Exception in thread "main"
com.google.gdata.util.ServiceForbiddenException: Forbidden
Insert not supported by feed
at
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:
520)
at
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:
466)
at
com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:
495)
at
com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:
473)
at
com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:
449)
at com.google.gdata.client.Service.insert(Service.java:814)
at com.google.gdata.client.GoogleService.insert(GoogleService.java:
687)
at TestApi.uploadFile(TestApi.java:30)
at TestApi.main(TestApi.java:55)
-----------------------------------
PS: the following is My program:
public class TestApi {
public void uploadFile(String filePath) throws IOException,
ServiceException {
DocumentEntry newDocument = new DocumentEntry();
File documentFile = new File(filePath);
newDocument.setFile(documentFile);
DocsService service = new DocsService("Document List Demo");
service.setUserCredentials("[EMAIL PROTECTED]", "XX");//please
update it
to your own user and password
newDocument.setTitle(new
PlainTextConstruct(documentFile.getName()));
DocumentListEntry uploaded = service.insert(new URL("http://
spreadsheets.google.com/feeds/spreadsheets/private/full"),
newDocument);
printDocumentEntry(uploaded);
}
public void printDocumentEntry(DocumentListEntry doc) {
System.out.println("id:"+doc.getId());
String shortId = doc.getId()
.substring(doc.getId().lastIndexOf('/') + 1);
System.out.println(" -- Document(" + shortId + "/"
+ doc.getTitle().getPlainText() + ")");
}
public static void main(String[] args) throws Exception {
TestApi testapi = new TestApi();
testapi.uploadFile("d:\\dev\\testupload2.xls");
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---