0

I've been trying to find an answer for this for a while and I have not come across something that explains whether it is possible or not:

I have a bunch of documents in Google Docs and I'm retrieving the list of them using gdata library. I have tried a bunch of different ways to display/open just a single one when I select one from the list but I have not been able to find what kind of request to do or url to send with the request.

The files are public and the share settings are set to public but they won't show up.

Can anyone help me out figure out how to open a Google Docs document (any file format) either in an UIWebView or in the native app?

EDIT Ok, I think there was a bit of confusion as to this question. I have a list of documents from a user's feed in which I store the resourceID of the documents in my database. These documents are public and therefore should be allowed to be opened and viewed by others. Say another user comes in and wants to view documents from another person. I call the resourceID into the viewer url and it still says it needs authorization. I figured, since the document is public, a user that has not logged in (therefore no auth token) should be able to view the document still. Just like google docs works?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Leo Correa
  • 19,131
  • 2
  • 53
  • 71

2 Answers2

2

I have no idea about Objective-C but I can tell you in general terms.. Just send an authenticated request at the below uri: Be sure to replace YourDocument'sResourceID with the resource ID of the document that you want to read..

https://docs.google.com/feeds/download/documents/export/Export?id=**YourDocument'sResourceID**&exportFormat=txt&format=txt

you can also play with the variable format in the above uri.. txt gives you the simple text and no styles..

Snehil Khanor
  • 153
  • 1
  • 12
  • Well the reason why that won't work is that the owner of the document has the document as public. Then someone who is not logged into google (no authentication) could see the document. The whole point is to be able to see other user's documents that are publically shared. – Leo Correa Apr 22 '12 at 18:21
  • Ok, I'm editing my post to better explain myself. Take a look at it and tell me what you think. – Leo Correa Apr 23 '12 at 18:56
2

The DocsSampleWindowController included with the Objective-C library includes a method that shows how to open a document using its HTML link:

- (IBAction)viewSelectedDocClicked:(id)sender {
  NSURL *docURL = [[[self selectedDoc] HTMLLink] URL];
  if (docURL) {
    [[NSWorkspace sharedWorkspace] openURL:docURL];
  }
}
grobbins
  • 1,564
  • 1
  • 8
  • 6