Month: July 2011

Disable List Deletion sharepoint 2010

If you don’t want users to be able to delete a specific SharePoint 2010 list, you can disable list deletion using Windows PowerShell. The example below demonstrates how to disable deletion of the tasks list on a Web site:

PS > $spWeb = Get-SPWeb
PS > $spList = $spWeb.Lists[“Tasks”]
PS > $spList.AllowDeletion = $false
PS > $spList.Update()
PS > $spWeb.Dispose()

fill dropdown list programatically from choice column in sharepoint

public void FillDropDownListChoice(SPList list, DropDownList drpList, string columnName)
                SPFieldChoice field = (SPFieldChoice)list.Fields[columnName];
                drpList.DataSource = field.Choices;
                if (columnName == Constants.FIELD_Language)
                    drpList.SelectedValue = “English”;
            catch (Exception ex)
                logError(“Error:In Filling Dropdown choice-” + drpList + “:”, ex);