Facebook Toolkit in Orcas preview?

Jun 16, 2007 at 11:26 PM

I would like to use the Facebook toolkit inside of Orcas with SilverLight 1.1. Has anyone done this successfully?

I am unable to set a reference to the proper Silverlight system DLLs at the same time as the Facebook projects reference version 2.0 framework DLLs.

Jun 18, 2007 at 2:29 PM
It won't work in Silverlight as currently constructed.

The issue is 2-fold. First, the FacebookService is a Component. Which is intended to ease winform development. But, that namespace is not in the Silverlight version of the CLR. Also, we use the XMLDocument (DOM) pretty extensively, and that is also not part of the silverlight CLR.

If there is interest. We could look at factoring the main functionality out of the component, and eliminating some of the use of the XML dom. You would still be stuck with the getFriendsXML like methods. But, it is possible for us to get that much working with Silverlight.

Jun 18, 2007 at 6:18 PM
Thank you, since this is an open source project, I am willing to assist in doing some of this if you think I would be able to do this eventually:

I'd like to be able to access the photo albums of a user and then show those photos in a way similar to what David Anson has done in his SilverLight "Surface" demo:


I suppose I could do it in "plain old WPF" more easily, but being able to do it in SilverLight would make it easier for people to install and use I think.

Let me know what you think..
Jun 18, 2007 at 9:39 PM
Its up to you. If you want to get involved and help with this. We welcome the contribution.

Basically the task would be:
1) Move functional code from FacebookService component into a regular class (maybe called FacebookAPI or something like that). Maintaining all interfaces.
2) Change the source inside of FacebookService to just be call throughs to the FacebookAPI class. This way, anyone who wants the component functionality can continue to use FacebookService as is. And still get drag and drop functionality in winforms.
3) Update Authentication code to not use XMLDocument when extracting user and session information from xml.

With these changes, you should be able to call the XML version of the methods from a Silverlight application.

I will add an issue tracker for this one.

Let me know if you would like to be added as a contributor for this project.
Jun 19, 2007 at 3:22 AM
Yes, I will do this.
Please add me.
Jun 19, 2007 at 2:45 PM
Jun 24, 2007 at 8:07 PM
Thank you,

It looks like the Facebook service also uses the MD5 class, which I don't think is available either.
I wonder if there is another way to achieve this? The problem that I see is that you have to call out to the facebook login page before you can continue, but maybe if I could accept credentials on behalf of the user I could login "behind the scenes" and execute commands.

I'm not sure how the facebook server handles authentication, but it seems like this should be possible.

rpowers119 wrote:

Jun 25, 2007 at 3:29 PM
I am going to play around with this today and get back to you.

There isn't any real way to authenticate behind the scenes. And even if there was, I don't think you can do it without the MD5 encryption. So, that might be a big problem.

I'll let you know later today.
Jun 25, 2007 at 11:24 PM
Good news and bad news.

Bad news is that it is going to be really hard (aka. A lot more work than I originally thought to use FacebookAPI.cs from a silverlight application.

There are several issues, including lack of system.xml, systemweb and md5 namesapaces. Also, Silverlight's limitation on cross-domain posting.

The Good news is that I have an idea of how to get it working. Basically, you need to host a proxy web service on the same webserver that hosts your silverlight application. Silverlight can call this since it is on the same domain, and this proxy web service can handle the facebook api calls using the existing facebook.dll. The tricky part is that the web page hosting the silverlight content will need to handle the facebook authentication logic, and then each call to the facebook proxy service will need to include: session, user, api_key and secret. Since the silverlight app will not be able to interact with the authentication flow.

I plan to get at least a working sample of this approach available by middle of the week.

This is a similar approach to what you do right
Jun 27, 2007 at 11:32 PM
I got a pretty simple example of a silverlight control with facebook context working. I created a new thread about it.


You will still need to do some work to get JSON serialization from the photos working. But, I show how to do it with my user example.

Hope it helps.