Bindas
Bindas

Reputation: 970

Google API to get the Content of Document/SpreadSheet

I want to get Display the content of a Google Doc in to the My own page.

I can get the List of all Document By using

http://code.google.com/apis/documents/docs/2.0/developers_guide_dotnet.html

 DocumentsService service = new DocumentsService("exampleCo-exampleApp-1");
service.setUserCredentials("[email protected]", "mypassword");
DocumentsListQuery query = new DocumentsListQuery();

DocumentsFeed feed = service.Query(query);

foreach (DocumentEntry entry in feed.Entries)
{
    Console.WriteLine(entry.Title.Text);
}

How can I display the content of Document in My page?

Upvotes: 3

Views: 732

Answers (2)

Vir
Vir

Reputation: 1354

You can get the Content by the below code.

 string content = string.Empty;
    string ACLS=string.Empty;
    foreach (DocumentEntry entry in feed.Entries)
    {

    if (entry.IsDocument)
    {
    var stream = client.Query(new Uri(entry.Content.Src.ToString()));
    var reader = new StreamReader(stream);
    content = reader.ReadToEnd();
    }
    }

Upvotes: 1

Slavo
Slavo

Reputation: 15463

Unless there's a property in the DocumentEntry class which returns the content of the document, I don't think there's a way. They don't seem to expose this through the API.

Upvotes: 0

Related Questions