SPListItemVersion.Created.ToLocalTime()
Thursday, 30 July 2009
SPListItemVersion.CreatedDate does not follow locale settings
Wednesday, 12 November 2008
Search error after upgrading to MOSS SP1 - System.IndexOutOfRangeException: DisplayInAdminUI

Sunday, 1 June 2008
Installing SharePoint on Vista
Monday, 10 March 2008
Group A List by Week Number
Add a Calculated column to the list called 'WeekNumber' that uses the following
formula: =INT(([Start Time]-DATE(2007,1,1))/7)
To avoid the hardcoding of year, we can use the following formula
=INT(([Start Time]-DATE(YEAR([Start Time]),1,1))/7)
Thursday, 29 November 2007
How to programmatically check who has posted last message in to a discussion?
I was working on a ‘Latest Updates’ web part for site. That site has Tasks List, Document Library, Wiki and a Discussion Forum. Everything was fine other than displaying data from discussion board. Here are some of the findings:
Objective:
-> To display no of replies to a discussion – Very easy. Just use “ItemChildCount” field of discussion board.
-> To display when was last message posted in the discussion – Again, just use “DiscussionLastUpdated” field.
-> To display who has posted last message into a particular discussion – Now this one is a bit tricky. But as we know Sharepoint treats each discussion as Folder, so we can query that particular folder (or we can say Discussion) to get the child items. Here is the sample code:
private string GetLastPostCreator(int nItemID)
{
string strAuthor = string.Empty;
SPWeb webCurr = SPControl.GetContextWeb(Context);
SPList lstDF = webCurr.Lists["Discussion Forum Name"];
SPListItem itemDiscussion = lstDF.GetItemById(nItemID);
SPFolder folder = itemDiscussion.Folder;
SPQuery query = new SPQuery();
query.Query = "
query.Folder = folder;
query.RowLimit = 1;
SPListItemCollection items = lstDF.GetItems(query);
foreach (SPListItem _item in items)
{
strAuthor = new SPFieldUserValue(webCurr, _item["Author"].ToString()).LookupValue;
}
return strAuthor;
}
Happy Coding J

