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


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=, 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.

How Sharepoint stores User Data

Lately I had fun digging into Sharepoint database and see how the monster was built and what its database schema looking like. Well, it’s pretty smart the way it was built but it’s also a pain for developers to understand and even to play with it, if they have to. With the business that I am working for, we have to create reports for corporates, which forces us to having to dig into Sharepoint database directly, even though I read a lot of posts saying that is not recommended by Microsoft.

Read More

Debug not working for Sharepoint

I had the problem of not able to debug Sharepoint in Visual Studio 2008 awhile ago, and glad that Aaron shown me how to do it by doing some tricks. What happened was the PDB file might not have been deployed to the assembly GAC.

What you do is:

  1. Start, Run, %systemroot%\assembly\gac, [ENTER].
  2. From there, go up one folder, then into GAC_MSIL folder.
  3. Paste the pdb file with the DLL, you will find yours amongst the folder names.

Restore list form web part for EditForm

Yesterday I spent the whole day finding on the Internet about how to restore the list form web part of my edit form as I accidentally deleted it and could never get it back from the Closed web parts, nor could I get it back by resetting the file to site definition in Sharepoint Designer. It is really important to remember that the original edit form, display form and new form should never be deleted, but kept as hidden if we had to customise them.

What happened after I deleted my edit form, caused the edit link to disappear in the display page, nor could I edit properties of any item, or it will just redirect to the AllItems.aspx page. So, to retrieve the edit form back, what we do is:

Read More

How to send email via Sharepoint

This is a useful function for sending a message via Sharepoint:

private void SendEmail(SPWeb oWeb, bool appendHtmlTag, bool htmlEncode,
            String toAddress, String subject, String message, bool elevated)
            //check if external email is set
            bool isExternalEmailSet = SPUtility.IsEmailServerSet(oWeb);
            if ((elevated == true) && (isExternalEmailSet == true))
            {//run elevated
                    SPUtility.SendEmail(oWeb, appendHtmlTag, htmlEncode, 
toAddress, subject, message);
            else if ((elevated != true) && (isExternalEmailSet == true))
            {//run un-elevated
                SPUtility.SendEmail(oWeb, appendHtmlTag, htmlEncode, 
toAddress, subject, message);

ScriptResource.axd from Ajax getting Too Big

Today I was testing the loading time of my site, which I sometimes find it slow to access especially the first time loading. I knew there are a lot of images to be loaded especially those in portfolio sections but I also found that the biggest loading item seems to be ScriptResource.axd from Ajax. It was 330kb!

Read More

Reading and Writing to Lookup Field in Sharepoint

Lookup field is a field which links a child class to a parent class, it is an association kind, which allows a list item to reference another item from another list. However, reading and writing to a lookup field is different from a normal field. We need to use the class SPFieldLookupValue to archieve this.

Read More

How to check if Constraint exist

A very useful statement to check if a constraint exists before do something to it. Note, we can never edit a constraint before deleting it and re-create.