DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Using Google's API To Access Picasa Albums

06.19.2008
| 6842 views |
  • submit to reddit
        Google provides its API in multiple languages. Here is an example that shows how to access a picasa album.

Before you start, you need to download Google's API for .NET. Then copy the files to you project (in the project explorer) in Visual Studio and in the references in the project explorer. Now you can make use of the namespaces:

using Google.GData.Client;
using Google.GData.Photos;

namespace GetPicasaFeed
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.getAtomFeed();
            return;
        }

        private void getAtomFeed()
        {

            // Album query and picasa query are specialized atomfeed classes
            AlbumQuery aQuery = new AlbumQuery(PicasaQuery.CreatePicasaUri("saschatayefeh"));
            PicasaService pService = new PicasaService("PicasaDemo");
            AtomFeed kResultFeed = pService.Query(aQuery);

            foreach (AtomEntry entry in kResultFeed.Entries)
            {
                this.textBox1.AppendText(entry.Title.Text + "\r\n");
                foreach (AtomLink eLink in entry.Links)
                {
                    this.textBox1.AppendText("  " + eLink.HRef.ToString() + "\r\n"); ;
                }
            }
            return;
        }

 
    }
}