This is done using System.ServiceModel.Syndication and allows you to specify a Sitecore feed URL and then access the items contained within. The code for that is relatively simple:
XmlReader reader = XmlReader.Create("http://test/feed"); SyndicationFeed sFeed = SyndicationFeed.Load(reader); reader.Close(); foreach (SyndicationItem item in sFeed.Items) { var title = item.Title.Text; var summary = item.Summary.Text; var link = item.Links.FirstOrDefault(); }
It's worth noting that the URL to the feed needs to include the server URL and not be relative.
This is also a great way to expose Sitecore content to third party systems (perhaps a SharePoint web part which displays the latest news on a web site for example). You can also get creative by having web forms for marketers create items in a location (that has an RSS feed) and then have a third party system read that feed...
No comments:
Post a Comment