Facebook Friends Live Collection
Yesterday, I presented you with a demo video of my Facebook Friends Collection for Pivot. Today, I have a live collection for you to play with. (Please note that Pivot is required)
Improved Facebook Friend Demo (I can't seem to get it to run on IIS as GoDaddy has it configured. This is most likely due to the inability to add MIME types. On the plus side, kudos to the Pivot team for this, as it makes it so a LAMP environment can easily serve it up.)
To make the application work, I have developed an easy-to-use method for turning almost any class in to a collection. This method was utilized in the example below, which shows the inner workings of Facebook Friends.
{
private List _books = new List();
private List _activities= new List();
private List _interests = new List();
private List _movies= new List();
private List _music = new List();
private List _tv= new List();
[PivotItem(IsName = true)]
public string Name { get; set; }
[PivotItem(IsDescription = true)]
public string Desc { get; set; }
[PivotItem(FacetDisplayName = "Books", FacetType = FacetTypes.String, IsFacet = true,IsCollection = true)]
public List Books
{
get { return _books; }
set { _books = value; }
}
[PivotItem( IsImage = true)]
public string Image { get; set; }
[PivotItem(FacetDisplayName = "Gender", FacetType = FacetTypes.String, IsFacet = true)]
public string Sex { get; set; }
[PivotItem(FacetDisplayName = "Relationship Status", FacetType = FacetTypes.String, IsFacet = true)]
public string RelationshipStatus { get; set; }
[PivotItem(FacetDisplayName = "Political Views", FacetType = FacetTypes.String, IsFacet = true)]
public string PoliticalViews { get; set; }
[PivotItem(FacetDisplayName = "Birth Date", FacetType = FacetTypes.String, IsFacet = true)]
public string BirthDate { get; set; }
[PivotItem(FacetDisplayName = "Activities", FacetType = FacetTypes.String, IsFacet = true, IsCollection = true)]
public List Activities
{
get { return _activities; }
set { _activities = value; }
}
[PivotItem(FacetDisplayName = "TV Shows", FacetType = FacetTypes.String, IsFacet = true, IsCollection = true)]
public List Tv
{
get { return _tv; }
set { _tv = value; }
}
[PivotItem(FacetDisplayName = "Music", FacetType = FacetTypes.String, IsFacet = true, IsCollection = true)]
public List Music
{
get { return _music; }
set { _music = value; }
}
[PivotItem(FacetDisplayName = "Movies", FacetType = FacetTypes.String, IsFacet = true, IsCollection = true)]
public List Movies
{
get { return _movies; }
set { _movies = value; }
}
[PivotItem(FacetDisplayName = "Intrests", FacetType = FacetTypes.String, IsFacet = true, IsCollection = true)]
public List Interests
{
get { return _interests; }
set { _interests = value; }
}
}
In order to populate the collection, I do something like this:
<span>// </span>In this space, there are about forty (40) lines of code that pull the data out of the Facebook API from CodePlex
<span>// and put it in to an instance of the above class. Then I add the data to the collection as follows:</span>
friends.Items.Add(facebookUserInstance);
friends.CollectionName = "Facebook Friends";
friends.WriteCollectionToFileSystem("test1.cxml");
<span>// </span><span>Next, I run the two command line tools for converting my friends' pictures into deep-zoom images and voila! It is done!</span>
I will be posting the Project for how the above works once the source code is cleaned up a bit and I am able to provide better documentation.
If you would like a copy of it before then, feel free to ask. I would be happy to send it to you if you post a comment requesting it.







































December 2nd, 2009 - 04:04
seems awesome, if possible i’d love it if you could send me the current project so i could take a look at the code.
December 2nd, 2009 - 15:19
It might be cool if you try to parse the birthdays into .Net DateTimes then change the Birthday Facet category to be of type DateTime instead of String.
December 2nd, 2009 - 17:27
True but facebook seems to provide inconsistent birthdays some just have day and month or month and year or just month. I’m sure that there is a way to get it to work correctly (probably using the format for the DateTime facet type) I just have to find it.
December 12th, 2009 - 04:06
Can you post us the code….I am trying to generate collection xml file from xml file.I mean to say my data is in xml file.
Thanks,
Naresh
December 16th, 2009 - 23:31
What do you mean like you want to read data out of an xml file?
February 2nd, 2010 - 19:06
Where is the “FacebookFriends.xml” file in Program.cs coming from? What does it contain exactly?
February 2nd, 2010 - 19:36
There is a tool that logs into Facebook and downloads your friends using Facebook Connect the output of that is FacebookFriends.xml
April 22nd, 2010 - 19:06
Could i have a copy of your code? I am trying to do something similar and i am quite interested in how you do everything on the fly including the images which has been causing some issues in my test code.
May 12th, 2010 - 14:27
Hello,
Can you please send me the code, i am trying to generate a custom collection based on specific data in DB. Thanks in advance
June 7th, 2010 - 11:16
Sadly I think that I have lost some of that stuff I am still looking for it but my life has been really crazy recently.
June 4th, 2010 - 14:22
Hi Matt, really love this project, I was wondering if you can share the code and know if the details info correspond to those friends of an applicaion / fanpage or to simple friends of a person. Can we also retrive location, region, or comments, amount of interactions with a fanpage or app?
Thanks so much, from Argentina.
June 7th, 2010 - 11:26
All that data comes from Facebook I very quickly picked a few data points to display but yes you could get any piece of data on Facebook into this. The only thing to watch out for is that there is very little consistancy in what people either fill out or choose to share. So make sure you error checking is good!
July 24th, 2010 - 16:06
i’d like to take a look at the code if you could..
December 17th, 2010 - 15:27
I’m interested in your project, could you pass it on or maybe post it in github?
Thanks
December 17th, 2010 - 15:28
Very interested in your project. Could you pass it on or post it on github?
Thanks in advance!