Blog

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");

Integrating Ajax into Sharepoint 2007

Recently, I had the chance to play around with ajaxifying Sharepoint server. As you would have probably known, Ajax is a great feature in .NET 3.5 but MOSS 2007 was shipped before Ajax was out. So, to use it, we just need some configurations done. There are a lot of articles on the Internet about how to archieve this, but the very best and well explained one can be found at Mike Ammerlaan’s blog: Integrating ASP.NET AJAX with SharePoint.

Read More

List Attachments Open as Read Only

I had the problem of saving files which I uploaded programatically to Sharepoint list item. When I tried to save them, there’s pop up dialog saying the file is in read only mode, even I had all the required permissions. There’s not much info on the net about this, and luckily I found the solution.

Read More

How to duplicate a Sharepoint list item

I was trying to add a duplicate link to the list item menu dropdown context box, so that user can click and duplicate an item. It’s actually quite easy to do that.

First, what we need to do is add the C# code so that when the item is saved, we check if there is a request query string of relevant item ID. If there is, that means this is going to be duplicated. So the logic works as follow:

Read More

How to create your own custom menu/item/actions in Sharepoint?

Often times we have to customise SharePoint’s stock user interface, particularly elements such as edit block, toolbar, menus, etc. It’s possible to have our own custom items in these areas, but first it would be a lot easier to understand their names and locations respectively. These are some of the common locations we will customize:

Read More

Sys.WebForms.PageRequestManagerParserErrorException

I had the problem of page not able to redirect when in an ajax postback. It happens to be the fact that I disabled a line in web.config:

<add name=”ScriptModule” type=”System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />.

This line should be added in HttpModules, so that redirection will work in Ajax postback. This class manages HttpModules for Ajax functionalities in ASP.NET.