Get the SpWeb
SPWeb web = SPContext.Current.Web;
using ( web = site.OpenWeb())
{
SPQuery query = new SPQuery();
discussionBoardUrl is the url which points to Discussion Board Exist
SPList list = web.GetListFromUrl(discussionBoardUrl);
Query the SpList to get Item Collection
string qLess = string.Empty;
qLess +=
"
query.Query = qLess;
SPListItemCollection listCollection = list.GetItems(query);
string subject = string.Empty;
string category = string.Empty;
litDiscussion.ID = "discussionBoard";
Loop with Each ITem In List Collection
string html = "";
ArrayList arrCategory = new ArrayList();
foreach (SPListItem listItem in listCollection)
{
string lcategory = listItem.GetFormattedValue("DiscussionCategory");
if (arrCategory != null && listCollection.Count > 0 && !arrCategory.Contains(lcategory.ToLower().Trim()))
arrCategory.Add(lcategory.Trim());
}
html = "
Discussion Board |
" + category + " |
> " + subject + " |
litDiscussion.Text = html;
1 comment:
Bravo, very good idea
Post a Comment