Thursday, 30 July 2009

SPListItemVersion.CreatedDate does not follow locale settings

While working on a requirement in one of ongoing projects, I noticed that CreatedDate is stored according to GMT in database for version items. A simple fix to convert it to local time is:

SPListItemVersion.Created.ToLocalTime()

Wednesday, 12 November 2008

Search error after upgrading to MOSS SP1 - System.IndexOutOfRangeException: DisplayInAdminUI

After upgrading to MOSS SP1, we started getting the following error on search results screen.

System.IndexOutOfRangeException: DisplayInAdminUI



After doing some research on internet and going through log file, we din't find any solution.

And then we decided to rebuild the SSP. That solved this problem.

Sunday, 1 June 2008

Installing SharePoint on Vista

I was really excited when I heard this. Then I tried installing MOSS 2007 on Vista and it works perfectly. Thanks to Bamboo Solutions. Check out this post for all the instructions from Jonas.

Monday, 10 March 2008

Group A List by Week Number

To group a list by week number, follow this post by Paul. I just wanted to make a small change to the formula which read as:
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

Sunday, 28 October 2007

10 signs that you aren’t cut out to be a developer

Justin James looks at 10 indications that you might not be well suited for a developer career. Check out this article.

Tuesday, 25 September 2007

Study recommendations for Sharepoint Exam (70-542)

Here is the link everybody was waiting for. Paul Galvin has prepared a nice list of links which is quite useful in preparing for Sharepoint certification exam (70-542 Microsoft Office SharePoint Server 2007 - Application Development).