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 http://SP01.powershell.nu
PS > $spList = $spWeb.Lists[“Tasks”]
PS > $spList.AllowDeletion = $false
PS > $spList.Update()
PS > $spWeb.Dispose()

Source:-secretsofsharepoint.com
Advertisements

fill dropdown list programatically from choice column in sharepoint

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