protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            if (string.IsNullOrEmpty(this.DocName))
            {
                base.Render(writer);
                return;
            }
            string username = "******";
            string password = "******";

            DocumentsService service = new DocumentsService("MyDocumentsListIntegration-v1");
            service.setUserCredentials(username, password);

            //DocumentsListQuery query = new DocumentsListQuery();
            TextDocumentQuery query = new TextDocumentQuery();

            // Make a request to the API and get all documents.
            DocumentsFeed feed = service.Query(query);

            // Iterate through all of the documents returned
            foreach (DocumentEntry entry in feed.Entries)
            {
                if (entry.Title.Text == this.DocName)
                {
                    writer.Write("<div class='gdoc'>");
                    Stream stream = service.Query(new Uri(entry.Content.Src.ToString()));
                    StreamReader reader = new StreamReader(stream);
                    writer.Write(reader.ReadToEnd());
                    writer.Write("</div>");
                    break;
                }
            }

            base.Render(writer);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            string username = "******";
            string password = "******";

            DocumentsService service = new DocumentsService("MyDocumentsListIntegration-v1");
            service.setUserCredentials(username, password);

            //DocumentsListQuery query = new DocumentsListQuery();
            TextDocumentQuery query = new TextDocumentQuery();

            // Make a request to the API and get all documents.
            DocumentsFeed feed = service.Query(query);

            // Iterate through all of the documents returned
            foreach (DocumentEntry entry in feed.Entries)
            {
                if (entry.Title.Text == "Rufo-Resume.doc")
                {
                    // Print the title of this document to the screen
                    Console.WriteLine(entry.Title.Text);
                    var stream = service.Query(new Uri(entry.Content.Src.ToString()));
                    var reader = new StreamReader(stream);
                    Console.WriteLine(reader.ReadToEnd());
                }
            }
        }