Use google docs in asp.net application

How can I use GOOGLE DOCS in my project, which I use asp.net with C # as code.

Basically I need to display some pdf, doc, dox, excel documents in a read-only form in a browser.

Thanks in advance

+6
google-docs
source share
2 answers

Google docs have an API for this.

The Google Docs List Data API allows client applications to programmatically access and manipulate user data stored in Google Docs.

Check out the documentation , it has examples and everything you need to develop something based on google docs.

+3
source share
using System; using System.IO; using System.Net; using Google.Documents; using Google.GData.Client; namespace Google { class Program { private static string applicationName = "Testing"; static void Main(string[] args) { GDataCredentials credentials = new GDataCredentials(" username@gmail.com ", "password"); RequestSettings settings = new RequestSettings(applicationName, credentials); settings.AutoPaging = true; settings.PageSize = 100; DocumentsRequest documentsRequest = new DocumentsRequest(settings); Feed<document> documentFeed = documentsRequest.GetDocuments(); foreach (Document document in documentFeed.Entries) { Document.DownloadType type = Document.DownloadType.pdf; Stream downloadStream = documentsRequest.Download(document, type); Stream fileSaveStream = new FileStream(string.Format(@"C:\Temp\{0}.pdf", document.Title), FileMode.CreateNew); if (fileSaveStream != null) { int nBytes = 2048; int count = 0; Byte[] arr = new Byte[nBytes]; do { count = downloadStream.Read(arr, 0, nBytes); fileSaveStream.Write(arr, 0, count); } while (count > 0); fileSaveStream.Flush(); fileSaveStream.Close(); } downloadStream.Close(); } } } } 
+1
source share

All Articles