Stuck again! Do any of the new apis support all of the high level client code, If so I'm hitting the ejector seat button. I don't care if I have to learn a new language from scratch be it "ruby on rails or whatever", the whole point of this exercise is to make developing new apps a " LEGO kit". Otherwise I am going to have to really study these low level protocols. It reminds me of my old assembler days. The more things change the more they remain the same. At least I can see from the other forum posts that I am not alone in my frustration. Step back for a second. Almost all of the forum questions involve what is essentially reading and writing data. I thought that was solved in the 1960s :)
I have a suggestion. Take all of the classes/methods that allow public and published data and produce a private and behind the firewall version that does exactly the same thing. Boom! Problems solved at once and I'll have a chance using Google internally. - Harry In the mean time could you please sherpa me to mid-base? On Jun 15, 2009, at 7:50 PM, Eric Bidelman wrote: > That 3rd parameter to update is a mimetype, not an file extension. > That's the GDocumntsAllowedType hashmap takes care of :) > > try: text/csv > > Eric > > On Mon, Jun 15, 2009 at 4:35 PM, harry mendell <harry.mend...@gmail.com > > wrote: > Google.GData.Client.GDataRequestException was unhandled > Message="Execution of request failed: > http://docs.google.com/feeds/media/private/full/spreadsheet:rqfFdRlpaWjFOyJ9MrslMjg > > " > Source="Google.GData.Client" > ResponseString="Malformed Content-Type" > StackTrace: > at Google.GData.Client.GDataRequest.Execute() > at Google.GData.Client.GDataGAuthRequest.Execute(Int32 > retryCounter) > at Google.GData.Client.GDataGAuthRequest.Execute() > at Google.GData.Client.Service.StreamSend(Uri targetUri, > Stream inputStream, GDataRequestType type, String contentType, > String slugHeader, String etag, AsyncSendData data) > at Google.GData.Client.Service.StreamSend(Uri targetUri, > Stream inputStream, GDataRequestType type, String contentType, > String slugHeader) > at Google.GData.Client.Service.Update(Uri uriTarget, Stream > input, String contentType, String slugHeader) > at myfirstcsharp.Program.Main(String[] args) in C:\Documents > and Settings\harry\My Documents\Visual Studio 2008\Projects > \updatesheet\myfirstcsharp\Program.cs:line 54 > at System.AppDomain._nExecuteAssembly(Assembly assembly, > String[] args) > at System.AppDomain.nExecuteAssembly(Assembly assembly, > String[] args) > at System.Runtime.Hosting.ManifestRunner.Run(Boolean > checkAptModel) > at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly() > at > System > .Runtime > .Hosting.ApplicationActivator.CreateInstance(ActivationContext > activationContext, String[] activationCustomData) > at > System > .Runtime > .Hosting.ApplicationActivator.CreateInstance(ActivationContext > activationContext) > at System.Activator.CreateInstance(ActivationContext > activationContext) > at > Microsoft > .VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone() > at System.Threading.ThreadHelper.ThreadStart_Context(Object > state) > at System.Threading.ExecutionContext.Run(ExecutionContext > executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.Net.WebException > Message="The remote server returned an error: (400) Bad > Request." > Source="System" > StackTrace: > at System.Net.HttpWebRequest.GetResponse() > at Google.GData.Client.GDataRequest.Execute() > InnerException: > > > On Jun 15, 2009, at 6:49 PM, Eric Bidelman wrote: > >> Sorry. The definition of GDocumntsAllowedType is in the lib's >> source: >> http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/src/gdocuments/documentservice.cs#56 >> >> What is the exception/response from the server? >> >> Eric >> >> On Mon, Jun 15, 2009 at 3:37 PM, harry mendell <harry.mend...@gmail.com >> > wrote: >> >> Dear Eric, >> I tried adapting your code and wrote a test which I copied below. >> It fails at >> DocumentEntry entry = service.Update(new >> Uri(lastUploadEntry.MediaUri.ToString()), stream, "CSV", >> lastUploadEntry.Title.Text) as DocumentEntry; >> which is almost at the bottom. I think I'm having a some code of >> compatibility issue between the ACL and token auth, but this end of >> the pool is pretty deep. >> Would you mind taking a look? >> Thanks, >> Harry >> >> >> >> >> >> >> using System; >> using System.IO; >> using System.Collections; >> using System.Net; >> using System.Collections.Generic; >> using Google.Spreadsheets; >> using System.Linq; >> using System.Text; >> using Google.GData.Documents; >> using Google.GData.Client; >> using Google.GData.Extensions; >> >> >> >> namespace myfirstcsharp >> { >> >> class Program >> { >> static void Main(string[] args) >> { >> DocumentsService service = new DocumentsService("HBM- >> DocListUploader-1"); >> ((GDataRequestFactory)service.RequestFactory).KeepAlive >> = false; >> service.setUserCredentials("qvtuat", "qvtqvtqvt"); >> //force the service to authenticate >> DocumentsListQuery query = new DocumentsListQuery(); >> query.NumberToRetrieve = 1; >> service.Query(query); >> >> >> // For testing only. Creates document called radar.csv >> DocumentEntry lastUploadEntry = >> service.UploadDocument("c:/radar.csv", "radar.csv"); >> // For testing only. Now lets see if we can update it >> FileInfo fileInfo = new FileInfo("c:/radar.csv"); >> FileStream stream = fileInfo.Open(FileMode.Open, >> FileAccess.Read, FileShare.ReadWrite); >> >> try >> { >> /* It didn't recogize GDocumntsAllowedType so I >> commented the check since I know its good type >> // convert the extension to caps and strip the "." >> off the front >> string ext = >> fileInfo.Extension.ToUpper().Substring(1); >> String contentType = >> (String)GDocumentsAllowedTypes[ext]; >> >> if (contentType == null) >> { >> throw new ArgumentException("File extension '" >> + ext + "' is not recognized as valid."); >> } >> // Make sure we don't overwrite someone else's >> changes. Use entry's ETag >> */ >> GDataRequestFactory factory = >> (GDataRequestFactory)service.RequestFactory; >> factory.CustomHeaders.Add("If-Match: " + >> lastUploadEntry.Etag); >> service.RequestFactory = factory; >> DocumentEntry entry = service.Update(new >> Uri(lastUploadEntry.MediaUri.ToString()), stream, "CSV", >> lastUploadEntry.Title.Text) as DocumentEntry; >> } >> finally >> { >> stream.Close(); >> } >> } >> } >> } >> >> >> On Jun 11, 2009, at 5:16 PM, Eric (Google) wrote: >> >>> >>> This worked for me: >>> >>> DocumentsService service = new DocumentsService("yourCompany- >>> AppName- >>> v1"); >>> // TODO: Fetch DocumentEntry >>> ReplaceDocContents(entryToUpdate, "C:\somewhere\test.doc"); >>> ... >>> >>> static public DocumentEntry ReplaceDocContents(DocumentEntry >>> entryToUpdate, string replacementFileName) >>> { >>> DocumentEntry entry = null; >>> >>> FileInfo fileInfo = new FileInfo(replacementFileName); >>> FileStream stream = fileInfo.Open(FileMode.Open, FileAccess.Read, >>> FileShare.ReadWrite); >>> >>> try >>> { >>> // convert the extension to caps and strip the "." off the front >>> string ext = fileInfo.Extension.ToUpper().Substring(1); >>> >>> String contentType = (String)GDocumentsAllowedTypes[ext]; >>> >>> if (contentType == null) >>> { >>> throw new ArgumentException("File extension '" + ext + >>> "' is not recognized as valid."); >>> } >>> >>> // Make sure we don't overwrite someone else's changes. Use >>> entry's ETag >>> GDataRequestFactory factory = (GDataRequestFactory) >>> service.RequestFactory; >>> factory.CustomHeaders.Add("If-Match: " + entryToUpdate.Etag); >>> service.RequestFactory = factory; >>> >>> entry = service.Update(new >>> Uri(entryToUpdate.MediaUri.ToString()), >>> stream, contentType, >>> entryToUpdate.Title.Text) as DocumentEntry; >>> } >>> finally >>> { >>> stream.Close(); >>> } >>> >>> return entry; >>> } >>> >>> You may have more luck next time if the post isn't "write my app for >>> me". >>> >>> Eric >>> >>> On Jun 11, 11:49 am, harry mendell <qvt...@gmail.com> wrote: >>>> I tried .net and first and can upload but not update. At this >>>> point I >>>> would be grateful for any solution. I've been at this for over a >>>> week >>>> and am ready to put my head through the wall:) >>>> >>>> PS I am able to do it a cell at a time with the spreadsheet api, >>>> but >>>> its slow, and besides I am not going to be able to sleep until I >>>> get >>>> this. I haven't felt like such a newbie since I poped out of my >>>> mother. Starting to feel postal. >>> >>> >> >> >> >> >> >> >> >> > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Docs Data APIs" group. To post to this group, send email to Google-Docs-Data-APIs@googlegroups.com To unsubscribe from this group, send email to google-docs-data-apis+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Docs-Data-APIs?hl=en -~----------~----~----~----~------~----~------~--~---