Click here to Skip to main content
Click here to Skip to main content

Read RSS Feeds from a Facebook Page On Windows Phone

, 7 Feb 2013
Rate this:
Please Sign up or sign in to vote.
Simple example of reading RSS feeds from Facebook page using Syndication Library

Introduction

I was searching for a way to keep in touch with my WP application users, and I've just figured out that the best way is to push my updates from my Facebook page, right to their WP screen. And it works fine. Maybe you'll even think of other useful things to do with this solution.

Using the Code

  1. Make sure to include:
    using System.Xml;
    using System.Net;
    using System.ServiceModel.Syndication;
  2. "System.ServiceModel.Syndication.dll" can be found at:

    C:\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.ServiceModel.Syndication.dll

  3. To finde your Facebook page ID go to this URL and replace PageName with yours:
  4. https://graph.facebook.com/PageName

    This is the main screen (note the page's title):

    And this is the RSS feeds after tapping the get RSS button:


  5. The code is so simple consists of two main parts: The response handler function where the dispatcher begins the invoking, and the other is the code of the button where the initiation of the request begins and calls it.

    Here is the code of the response handler:

    HttpWebRequest request = (HttpWebRequest)asyncResult.AsyncState;
    
    HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asyncResult);
    
    if (response.StatusCode == HttpStatusCode.OK)
    {
        XmlReader reader = XmlReader.Create(response.GetResponseStream());
        SyndicationFeed newFeed = SyndicationFeed.Load(reader);
    
                        
        Dispatcher.BeginInvoke(() =>
        {
            this.PageTitle.Text = newFeed.Title.Text;
            foreach (SyndicationItem sItem in newFeed.Items)
            {
                listBox1.Items.Add(sItem.Title.Text);
            }
        });
    }
    

Points of Interest

In the response handler don't add any code above the Dispatcher.Invoke() or it will rise an exception.

History 

Don't be shy.. if there is any questions plaese feel free to ask.. or inbox your question here: facebook.com/amabualrub

If you found this useful, Please rate it  

Good luck & Happy coding 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Abdullatif M. Abu Al Rub
Software Developer
Jordan Jordan
No Biography provided

Comments and Discussions

 
Questionfacebook Pinmemberbid or buy26-Jun-12 2:35 
AnswerRe: facebook Pinmemberamabualrub28-Jun-12 0:53 
AnswerRe: facebook PinmentorDaveAuld28-Jul-12 6:33 
AnswerRe: facebook PinmvpSandeep Mewara28-Jul-12 7:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 7 Feb 2013
Article Copyright 2012 by Abdullatif M. Abu Al Rub
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid