Monthly Archive » October 2010

Accessing parent web list items carefully

I spent quite some time today fixing this problem of accessing a list item in parent web. What I had to do was to access a list item in a parent web, but strangely it kept returning no result, and I made sure the item did exist in the list.

Then I found out it’s due to permission issue. When accessing a parent web’s list items, you have to run your code under elevated privileges mode, otherwise if you debug it you will see that it crashes when trying to access them.

How Sharepoint stores datetime field in UTC

Lately we found a very interesting fact of Sharepoint, which I think is worth writing a post about. Although it is very rare that someone will read directly into Sharepoint database to retrieve information, but for some hardcore users, especially with my last post regarding how Sharepoint stores data in backend database, one can easily read into Sharepoint Prod_Content database and do CRUD transactions.

Read More

How to select distinct from SPQuery CAML

A handy way to select distinct records from SPListItemCollection set queried from CAML query. This is very useful when we want to select a number of unique records from a data table.

DataTable dtt = myWeb.Lists["LISTNAME"].GetItems(spQuery).GetDataTable();
DataView dtv = new DataView(dtt);
dtt = dtv.ToTable(true, "COLUMNNAME");