Save A Google Docs Document As A File In .NET

Given a DocumentEntry, save to local file "C:\example.html"
Uri documentUri = new Uri(entry.Content.AbsoluteUri);
Stream stream = service.Query(documentUri);
StreamReader streamReader = new StreamReader(stream);
StreamWriter streamWriter = new StreamWriter("C:\\example.html");
string line = "";
while( (line = streamReader.ReadLine()) != null) {
    streamWriter.WriteLine(line);
}
streamReader.Close();
streamWriter.Close();

7 comments:

  1. I am using your method to download a Doc file from my Google Doc account, but the images in the Doc file went missing.

    Currently use the new v1.5 .Net client, and noticed the DocumentsRequest.Download() method.

    However, it request parameter of Document, so how do I pass in DocumentEntry?


    Thanks!

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete