Monthly Archives: July 2012

You are browsing the site archives by month.

Iterating through a SharePoint discussion list

One of those things that you think should be pretty straightforward…

Credit to Dave Ginn for finding the solution.

List itemList = new List();

foreach (SPListItem discussion in discList.Folders)
   //discussion.Title is discussion title
   SPQuery query = new SPQuery();
   query.Folder = discussion.Folder;
   SPListItemCollection messages = discList.GetItems(query);
   itemList.Add(new Discussion(discussion.Title, messages.Count));

//sort by most comments
itemList.Sort(delegate(Discussion p1, Discussion p2)
{ return p2.Comments.CompareTo(p1.Comments); });

Here’s the site I used for reference:

Essential reading for SharePoint Admins

Told you I’d be back. 😉

Here’s an invaluable article that explains exactly how the MySite Cleanup Timer Job works.  If you’re an admin, you WILL get questions about this eventually so better to get the knowledge now.

So it’s been awhile…

I just realized it’s been over a year since I last posted.  Needless to say, I’ve been busy. 🙂  I hope to be more active again in the future.  Stay tuned.

Switch to our mobile site