GetAlbums(userid) not returning anything

Jul 19, 2007 at 12:16 PM

I've just started looking at Facebook development, so this may be a silly question.

If I have a web app and I want to display a user's photos, what needs to happen to allow this? I have tried using the GetAlbums(userid) method but it only seems to work for my own userid. If another user gives me their userid, it returns no data.

I have used the following code:

_fbService.ApplicationKey = "mykey";
_fbService.Secret = "mysecret";
_fbService.IsDesktopApplication = false;
_fbService.SessionKey = "a non-expring session key i generated";
_fbService.UserId = "my user id";
System.Collections.ObjectModel.Collection<Facebook.Album> albums = _fbService.GetPhotoAlbums("the other users id");

But no album data is returned.

Obviously I'm missing something. What is it?


Jul 19, 2007 at 7:43 PM

My guess is that either that person doesn't have albums, or they aren't your friend.

Facebook has alot of privacy policies in place, and they restrict what you can see on others profiles. For instance, I am pretty sure I can only programmatically access the photos for friends.

So, for instance if I login to my app as myself do a getFriends (which returns my friends) and then pass the userid of my first friend to GetPhotoAlbums it works fine. But, I don't think it works for anyone's albums. But, I can test that if you want.
Jul 20, 2007 at 1:15 AM
Thanks for the reply.

I think that's correct - I need to be their friend or part of the same Network. I added myself to the Australia network and now the method works for anyone else in that Network.

I don't understand the best practice though. If someone uses my website and wants their Facebook photos displayed to all other users of my website, how do I achieve this? I thought I could just make the calls with my userid and a non-expiring session token. Surely I don't need all my users to generate non-expiring session tokens for me?

I have 120,000 registered users on my website. Tyring to avoid as much hassle as possible!!

Feb 22, 2010 at 5:39 PM

I am using the photoAlbum component available in Facebook.WinForms container.

photoAlbum1.Albums = FacebookService1.Photos.GetAlbums(user.uid.Value);

It does not return the photos of the user.

What am I missing?



Oct 10, 2010 at 5:34 PM

what is this FacebookService1 object which class is this and which namespace is it using. I just started creating a small app. I could not get list of friends.