Google Groups Home
Help | Sign in
retrieve selected Document
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
riba  
View profile
 More options Jul 24, 8:28 am
From: riba <abir.bhattacha...@gmail.com>
Date: Thu, 24 Jul 2008 05:28:15 -0700 (PDT)
Local: Thurs, Jul 24 2008 8:28 am
Subject: retrieve selected Document
Hi all,

I have the following requirements:

1. After Client Authentication show a list of my documents ( I am able
to do this using the Google DocumentList API)

2. download the selected word processor document

( actually I tried trapping the response Atom feed and porting that to
XML using the SaveToXML() method but the <entry> node <content type >
did not contain any <xhtml> data)

3. would like to edit the downloaded doc and then maybe upload it
again (using the DocumentList Upload() method)

I am stuck with #2 , Any ideas would be great , Is this possible or
not ?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeff S  
View profile
 More options Jul 25, 1:18 pm
From: Jeff S <j...@google.com>
Date: Fri, 25 Jul 2008 10:18:56 -0700 (PDT)
Local: Fri, Jul 25 2008 1:18 pm
Subject: Re: retrieve selected Document
Hello riba,

On Jul 24, 5:28 am, riba <abir.bhattacha...@gmail.com> wrote:

> Hi all,

> I have the following requirements:

> 1. After Client Authentication show a list of my documents ( I am able
> to do this using the Google DocumentList API)

> 2. download the selected word processor document

> ( actually I tried trapping the response Atom feed and porting that to
> XML using the SaveToXML() method but the <entry> node <content type >
> did not contain any <xhtml> data)

Each of the entries in the feed has a content element with the src
attribute set to the URL of the HTML version of the document contents.
So if you want to download the document content, you can use the
authenticated client to perform an HTTP GET on the src URL and the
server will send you the HTML. How is you client authenticated,
ClientLogin, AuthSub, OAuth?

> 3. would like to edit the downloaded doc and then maybe upload it
> again (using the DocumentList Upload() method)

The Document List API does not currently support the replacement of
document contents. You can add new documents, and remove documents,
but you would not be able to replace the contents of an exiting
document. So you would be able to edit the downloaded doc, but you
would have to insert as a new document rather than update.

> I am stuck with #2 , Any ideas would be great , Is this possible or
> not ?

Happy coding,

Jeff


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
riba  
View profile
 More options Jul 28, 8:34 am
From: riba <abir.bhattacha...@gmail.com>
Date: Mon, 28 Jul 2008 05:34:18 -0700 (PDT)
Local: Mon, Jul 28 2008 8:34 am
Subject: Re: retrieve selected Document
Hi ,

Thanks for the reply and help :

 I am doing a ClientLogin Authetication , something like
AuthServ=new DocumentsService("GDocPlug-in");
                AuthServ.setUserCredentials("uid","pwd");

Can retreive the token using
string tok=AuthServ.QueryAuthenticationToken(); // which is retreiving
correctly I guess

Value is something like :

DQAAAH0AAACRzEtYGG5Q6aeNnXtdQajEtqOERSEKAht57m4Yp6JWChr01kjjvrhOeyJJ0EeZb
lHpM68S-
gDqcf5wDoVVLDSdFPdGSz0PFIxrk86gNtS1t9XpoMDtjuV8I22dHlX3wdF0QK9D34pwxzSmL

But as you pointed out doing a HTTP GET request on the 'src' using the
authenticated client (in my case AuthServ)  , but how do I do that ? .
I was trying to use the c# System.NET HttpRequest but that is a new
external request again !! , how would i go about doing a HTTP GET
using the clientlogin authenticated service which I already have ??

Regards

Riba

On Jul 25, 10:18 pm, Jeff S <j...@google.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jochen Hartmann (Google)  
View profile
 More options Jul 28, 11:03 am
From: "Jochen Hartmann (Google)" <api.jhartm...@google.com>
Date: Mon, 28 Jul 2008 08:03:42 -0700 (PDT)
Local: Mon, Jul 28 2008 11:03 am
Subject: Re: retrieve selected Document
Hi Riba,

I think you can just use the .Query method to return a HTTP response.
Please refer to the source code:

http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/...

Let me know if that helps
Thanks
- Jochen

On Jul 28, 8:34 am, riba <abir.bhattacha...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
riba  
View profile
 More options Jul 29, 12:11 pm
From: riba <abir.bhattacha...@gmail.com>
Date: Tue, 29 Jul 2008 09:11:37 -0700 (PDT)
Local: Tues, Jul 29 2008 12:11 pm
Subject: Re: retrieve selected Document
Hi ,

Thanks for the pointer, The present scenario being

Stream s=AuthServ.Query(new Uri("http://docs.google.com/a/Test.com/
RawDocContents?
action=fetch&amp;justBody=false&amp;revision=_latest&amp;editMode=....."));

but I get a Non-seekable stream (s) and I am not being able to convert
that to byte[] or any MemoryStream object  as I need the content of
it, hence I am unable to determine whether I am getting the correct
html content.

 It always throws an exception like.... 'This stream does not support
seek operations.'

Have i performed the query operation correctly ?

Thanks Again

-Riba

On Jul 28, 8:03 pm, "Jochen Hartmann (Google)"


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jochen Hartmann (Google)  
View profile
 More options Jul 29, 5:57 pm
From: "Jochen Hartmann (Google)" <api.jhartm...@google.com>
Date: Tue, 29 Jul 2008 14:57:46 -0700 (PDT)
Local: Tues, Jul 29 2008 5:57 pm
Subject: Re: retrieve selected Document
Riba,

I don't use c# very much but looking at some of the MSDN docs seems to
show that you need to use a StreamReader. Here is a snippet for how to
save a documents into a file:

http://gdatatips.blogspot.com/2008/07/save-google-docs-document-as-fi...

Cheers,
- Jochen

On Jul 29, 12:11 pm, riba <abir.bhattacha...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
riba  
View profile
 More options Jul 30, 6:50 am
From: riba <abir.bhattacha...@gmail.com>
Date: Wed, 30 Jul 2008 03:50:43 -0700 (PDT)
Local: Wed, Jul 30 2008 6:50 am
Subject: Re: retrieve selected Document
Hi,

Thanks for the update, but the html content (as it got earlier too) is
the html for Login Page

I am using a ClientLogin Authentication here :

AuthServ=new DocumentsService("GD");
AuthServ.setUserCredentials("uid","pwd");

Stream s=AuthServ.Query(uri);
StreamReader sr =new StreamReader(s);
// content html
StreamWriter sw=new StreamWriter("c:\\test.html");
string ln="";
while((ln=sr.ReadLine())!=null)
{
    sw.WriteLine(ln);

 }

 sr.Close();
 sw.Close();

but "test.html" consists of the HTML for the  login Page !!! I am
unable to get the raw contents here of the actual document. ?? .
Although the same "AuthServ" is able to give me a list of the
Dcouments available on the server.

Is the authorization not happening correctly ?? , I am at a loss to
why this is happening

Thanks Again
Riba

On Jul 30, 2:57 am, "Jochen Hartmann (Google)"


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jochen Hartmann (Google)  
View profile
 More options Jul 30, 1:59 pm
From: "Jochen Hartmann (Google)" <api.jhartm...@google.com>
Date: Wed, 30 Jul 2008 10:59:15 -0700 (PDT)
Local: Wed, Jul 30 2008 1:59 pm
Subject: Re: retrieve selected Document
Riba,

Sorry for not noticing this earlier, but I didn't realize until now
that you are using a hosted account. There is a bug in the DocList API
and it is currently not possible to use ClientLogin or AuthSub
authentication to access the Raw document contents for Google Apps
domains. Please star the feature request starred below to vote for
this feature to be implemented and to be notified when it has been
done:

http://code.google.com/p/gdata-issues/issues/detail?id=542

Thanks
- jochen

On Jul 30, 6:50 am, riba <abir.bhattacha...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
riba  
View profile
 More options Jul 31, 12:32 am
From: riba <abir.bhattacha...@gmail.com>
Date: Wed, 30 Jul 2008 21:32:50 -0700 (PDT)
Local: Thurs, Jul 31 2008 12:32 am
Subject: Re: retrieve selected Document