let em show sharepoint feeds as well

Dec 10, 2009 at 9:44 AM
Edited Dec 10, 2009 at 3:34 PM

Thank you for your great work, I had a few problems to let em aggregate Sharepoint own feeds as well, but here is the Solution:

Made  boolean field , to enable choice of using credentials in webpart edit pane, and send this bool to constructor of RssFeed.

Edit the Xmlparsing to use Xdocument:

 

var client = new WebClient();
if (usecredentials)
{
client.UseDefaultCredentials = true;
client.Credentials = CredentialCache.DefaultCredentials;
}

using (var ds = client.OpenRead(url))
{
using (var dr = new XmlTextReader(ds))
{
var xdoc = XDocument.Load(dr);
_rssDoc = xdoc.Element("rss");
}
}

 

Have fun , and for adding a bit syntactical sugar

 by using System.Linq and

List<RssItem> feed5 = feed.OrderByDescending(p => p.PubDate).Take(_feedLmt).ToList();

you can get rid of the i Interation and the Sort Delegate

and using

 

if (!string.IsNullOrEmpty(_filterCriteria)) 
{
if (singleRssItem.Tags == null) continue;
if (!singleRssItem.Tags.ToLower().Contains(_filterCriteria))continue;
}

 

will reduce nesting in the loop

Ren

Dec 10, 2009 at 8:23 PM

Ren, thanks for the update! I had some trouble getting it to work, but it finally did

                        var client = new WebClient();
                        client.UseDefaultCredentials = true;
                        client.Credentials = CredentialCache.DefaultCredentials;
                        using (var ds = client.OpenRead(url))
                        {
                            using (var dr = new XmlTextReader(ds))
                            {
                                var xdoc = XDocument.Load(dr);
                                rssDoc = xdoc.Element("rss");
                                foreach (var elm in rssDoc.Descendants("item"))
                                {
                                    this.Add(new RssItem(elm));
                                }

                            }
                        }

Thanks!

 

 

 

 

Dec 28, 2009 at 3:00 PM

Is this the same thing as using delegation?

Also is this code added in the build package that we can download? I looked at the source code and it was not added there. If it is not added to the package, when are you planing to add it.