Getting photos using API in wpf application

Dec 31, 2009 at 2:10 PM

Hi there,

Hope everything is going fine with you guys. I am facing a problem that is i want to get photos of my account and show in a window using WPF application. I am getting errors like "Could not able to deserialize" when getting the albums -- IList<album> albums = api.Photos.GetAlbums(me.uid.Value);. Please help in solving this issue.

Here is my code

 

 try
            {
                user me = api.Users.GetInfo();
                IList<album> albums = api.Photos.GetAlbums(me.uid.Value);               
                List<string> pid = new List<string>();
                int i = 1;
                foreach (album a in albums)
                {
                    ListViewItem lvi = new ListViewItem();
                    lvi.Tag = a;
                    lvi.Name = a.name;

                    //check for a missing album image and put generic placeholder
                    if (string.IsNullOrEmpty(a.cover_pid) || a.cover_pid == "0")
                    {
                        lvi.TabIndex = 0;
                    }
                    else
                    {
                        lvi.TabIndex = i;
                        i++;
                    }
                    lvAlbums.Items.Add(lvi);

                    pid.Add(a.cover_pid);
                }

                foreach (album a in albums)
                {
                    IList<photo> photos = api.Photos.Get(me.uid.Value.ToString(),a.aid,pid);

                    foreach (photo p in photos)
                    {
                        Image img = new Image();                       
                    }                  
                }
            }
            catch { }


Thanks and Regards

Jan 1, 2010 at 12:32 PM

Could be the same issue as the one described in this thread: http://facebooktoolkit.codeplex.com/Thread/View.aspx?ThreadId=72848

Jan 2, 2010 at 5:48 PM

Hi, 

So in the thread given above it is mentioned that we must have current location and profile pictures. So I have added current location and profile pictures and I succeeded in getting the albums collection. 

Thanks for the help.

Now I am facing one more problem that is I am unable to get the photos now. My code is same as above. please help to solve this issue.

Thanks and Regards.