SharePoint 2010 List RSS Feed is not validated by W3C Feed Validator
-
8 สิงหาคม 2555 3:42
Guys,
I have a Calendar List which has 1000 rows of events and i had Rss feed from that list but this is not validated by w3c Feed validator.
i am thinking to create RSS Feed programmatically, or is there any idea how can i fix this issue ?
Anyone has any idea creating RSS Feeds programmatically from sharepoint list ?
Thanks
ตอบทั้งหมด
-
8 สิงหาคม 2555 4:34
Here is a code snippet which uses WCF 3.5 to generate a RSS Feed.
[OperationContract] [WebGet] public Rss20FeedFormatter GetProductsAsFeed(string format) { List<SyndicationItem> feeditems = new List<SyndicationItem>(); using (SPWeb web = SPContext.Current.Web) { SPList list = web.Lists["listname"]; SPListItemCollection items = list.Items; foreach (SPListItem item in items) { feeditems.Add(new SyndicationItem() { Title = new TextSyndicationContent(item.Title), Summary = new TextSyndicationContent( item["Description"].ToString()), Copyright= new TextSyndicationContent( "blah blab")}; } } SyndicationFeed feed = new SyndicationFeed(feeditems.ToList()); return new Rss20FeedFormatter(feed); }
Hope that helps.
Regards,
Nauzad Kapadia
- ทำเครื่องหมายเป็นคำตอบโดย Daniel YangMicrosoft, Moderator 16 สิงหาคม 2555 10:19
-
8 สิงหาคม 2555 13:15
Hello,
Is this web services ? How can it create URL for Feeds ? Can you elaborate little more for me ?
Thanks.
-
8 สิงหาคม 2555 14:16
Hi Kevin,
Yes, this code is meant to go into a WCF Web Service. Since it uses the SharePoint Server object model, the web service will have to be hosted on the same server as the one on which SharePoint is installed.
So if the web service is named ExposeRSSFeeds.svc and it exposed a operation named GetProductsAsFeed, then the url to access the feeds would be -
http://server.../virtualdirectory/ExposeRSSFeeds.svc/GetProductsAsFeed
If the operation accepts any input parameters, then pass them thru the querystring.
Hope this clears your doubts.
Regards,
Nauzad Kapadia.
Please "Mark as Answer" if a post has answered your question or "Vote as Helpful" if it was helpful in some way. Here's why
- ทำเครื่องหมายเป็นคำตอบโดย Daniel YangMicrosoft, Moderator 16 สิงหาคม 2555 10:19
- แก้ไขโดย Nauzad KapadiaMVP 16 สิงหาคม 2555 11:34 typo in the url