I want to get rss feeds from multiple sources and store into the list. Is there anyway to get rss feeds from specified urls and store them in to the list? Please provide reference links or code example.
Thank you.
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityIt is really simple. The best way is creating an External list using Visual Studio.
Here is a service class I wrote.
public partial class BlogArticleService
{
private const string FeedUrl = "http://blogs.microsoft.com/feed/";
private const string DateDisplayFormat = "MM-dd-yyyy";
private static List<BlogArticle> blogArticles = new List<BlogArticle>();
public static IEnumerable<BlogArticle> ReadList()
{
XmlReader reader = XmlReader.Create(BlogArticleService.FeedUrl);
SyndicationFeed feed = SyndicationFeed.Load(reader);
reader.Close();
blogArticles = new List<BlogArticle>();
int id=0;
foreach (SyndicationItem item in feed.Items)
{
BlogArticle currentArticle = new BlogArticle();
currentArticle.ID = id;
currentArticle.Title = item.Title.Text;
currentArticle.LinkToArticle = item.Links[0].Uri.AbsoluteUri;
currentArticle.PublishedDate = item.PublishDate.Date.ToString(BlogArticleService.DateDisplayFormat, CultureInfo.InvariantCulture);
blogArticles.Add(currentArticle);
id++;
}
return blogArticles;
}
public static BlogArticle ReadItem(int iD)
{
return blogArticles.Where(m => m.ID == iD).First();
}
}
My blog has much resources. Here is a good starting point.
As far as I know, there is no direct mechanism in SharePoint to import the content of RSS feeds into a list. The simplest solution would be to write a custom Timer Job that grabs the RSS feed and populates the list.
The RSS feed can, for example, be read with the SyndicationFeed class or a custom reader. RSS is - after all - only XML...