Author Archive » Admin

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
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    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.

SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_SCHEMA=’dbo’
AND CONSTRAINT_NAME=’FK_37_Page_FK’ AND TABLE_NAME=’PageContent’

Customise Column Permissions for Sharepoint List

SharePoint list has permission down to the list level, but what if we need to control view, edit and display for each column? I have been researching on a lot of add-ons around the Internet and luckily found one that works just brilliantly. There’s this add-on called SPListDisplaySetting, hosted on CodePlex, which allows you to do that. Strange thing is the first time I installed it, it didn’t work as it cooked up my list to not showing the action toolbar and i had to re-install WSS to get it back in shape.

Read More

Creating Custom Field Type in Sharepoint List

Sharepoint comes with a great GUI tool that allows administrator to create and manage data structure, that means we could create our own columns and set up the associations, etc. However, the default field types out from the box are limited. The great news is we could create our own field types with own business logic. I just tried to create a custom field type called “Phone Number”, which is a standard text field but with Javascript validator that validates the input string to be a valid phone number.

Read More

Tools to get started on Sharepoint Development

I have been digging into SharePoint for awhile now and it seems to be more and more interesting and challenging, considering I already have experiences with so many different Content Management Systems. Suprisingly, SharePoint seems to work very similar to Helium, so that eased my process of going in and out of Sharepoint.

Here’s a list of tools to be installed first before any further development can proceed:

Read More