Tuesday, May 20, 2008

How to Shrink SharePoint content database size?

Run following SQL command to free up space of sharepoint content database

dbcc shrinkdatabase(WSSContentDatabaseName)

Saturday, May 3, 2008

How to Hide Fields in SharePoint List Form Pages using jQuery

Yesterday, one of friend ask me can we show/hide fields in Newform.aspx and Editform.aspx by clicking on checkbox. It can be done thru sharepoint designer with some rules. But I used jQuery with few lines of code in Task List. I added 1 more field i.e. ShowFields as choice field.


























Then I added a content editor webpart on newform.aspx. MOSS wont allow to edit newform.aspx and editform.aspx. To add webpart on newforn.aspx / editform.aspx, add in &ToolPaneView=2 on the end of the url. So your url for newform.aspx will be http://portal/Lists/Tasks/NewForm.aspx?RootFolder=%2FLists%2FTasks&Source=http%3A%2F%2Fportal%2FLists%2FTasks%2FAllItems%2Easpx&ToolPaneView=2

In source editor of content editor web part, I have added following script

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>

<script>
$(document).ready(function()
{
$("input[title$='ShowFields']").click(function()
{
$("input[title$='Title']").parent('span').parent('td').parent('tr').toggle();
$("nobr:contains('Start Date')").parent('h3').parent('td').parent('tr').toggle();
$("nobr:contains('Due Date')").parent('h3').parent('td').parent('tr').toggle();
});
});
</script>

and close the webpart page. Then open newform.aspx, now whenever I click on Showfields Checkbox then Title/Start Date/Due Date fields are hidden, once I uncheck this it shows the fields again.

Saturday, April 19, 2008

How to set permission and restrict view to particular user

Using following tool you can set permissions to views and restrict views to particular users. This feature is not available in MOSS 2007.

http://www.codeplex.com/SPViewPermission

Saturday, April 12, 2008

How to set field permission in Sharepoint List

Folllowint tool providing advanced settings to customize list form rendering in new, display and edit mode.

http://splistdisplaysetting.codeplex.com/

Saturday, March 29, 2008

Disable Right Click on Sharepoint Portal

Add a content editor web part and add following code in the source editor