Friday, July 29, 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

Thursday, July 28, 2011

Activate Taxonomy feature on sharepoint site

STSADM -o activatefeature -id 73EF14B1-13A9-416b-A9B5-ECECA2B0604C -url http://webApp/sites/siteName/ -force

Wednesday, July 27, 2011

Check 'Person or Group' column is empty or not in Workflow sharepoint

following workflow steps checks 'Person or Group' column contains value or not then assigne it to approval process
















Note:- Select 'return field as' 'string' at all places and while assigning task select Uservariable as 'login name, semicolon delimitted' 

Tuesday, July 26, 2011

Save site collection as template sharepoint

type below path after your site collection name in address bar

/_layouts/savetmpl.aspx

it will create wsp file

Monday, July 25, 2011

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);
            }
        }

Copy list workflow to other site or list sharepoint

Friday, July 22, 2011

Edit internal pages in Sharepoint 2010 which comes as Pop-up

1.Right click and click on 'open in new tab'

2.it will open Upload page

3. browse file and click on ok

4. it will open editform.aspx

5. add querystring to this page as '&ToolPaneView=2'

6. hit enter it will open that page in Edit mode

JQuery for hiding 'table row'/'Control' on listbox selected value

Replace 'DOLLAR' with '$'

DOLLAR(document).ready(function ()
 {
 DOLLAR("#ROWYesNo").hide();
    DOLLAR("#[idDOLLAR=_radioListYesNo]").click(function () {

        var rblSelectedValue = DOLLAR('#[idDOLLAR=_radioListYesNo] input:checked').val()
        if (rblSelectedValue == "Yes") {
            DOLLAR("#ROWYesNo").hide();
        }
        if (rblSelectedValue == "No") {
            DOLLAR("#ROWYesNo").show();
            DOLLAR('input[type="text"]').each(function () { DOLLAR(this).attr('readonly', 'readonly'); });
        }
    });
});
});

JQuery for hiding 'table row'/'Control' on dropdownlist selected value


Replace 'DOLLAR' with '$'


DOLLAR(document).ready(function ()
 {
 var trial1 = DOLLAR("#[idDOLLAR=_ddlWorflowStage] option:selected").text();
 if (trial1 == "Copy")
 {
 DOLLAR("#[idDOLLAR=_ROWreviewers]").show();
 DOLLAR("#[idDOLLAR=_ROWmarcomApproval]").hide();
 DOLLAR("#[idDOLLAR=_ROWlegalApprovwers]").hide();
 }
 DOLLAR("#[idDOLLAR=_ddlWorflowStage]").change(function ()
 {
 var trial = DOLLAR("#[idDOLLAR=_ddlWorflowStage] option:selected").text();
 if (trial == "Copy")
 {
 DOLLAR("#[idDOLLAR=ROWreviewers]").show();
 DOLLAR("#[idDOLLAR=ROWmarcomApproval]").hide();
 DOLLAR("#[idDOLLAR=ROWlegalApprovwers]").hide();
 }
 if (trial == "Layout")
  {
 DOLLAR("#[idDOLLAR=ROWreviewers]").show();
 DOLLAR("#[idDOLLAR=ROWmarcomApproval]").show();
 DOLLAR("#[idDOLLAR=ROWlegalApprovwers]").hide();
 }
 if (trial == "Final")
  {
 DOLLAR("#[idDOLLAR=ROWreviewers]").hide();
 DOLLAR("#[idDOLLAR=ROWmarcomApproval]").hide();
 DOLLAR("#[idDOLLAR=ROWlegalApprovwers]").show();
 }
});

SharePoint document metadata not updating

I faced a weird issue today, Metadata for document which has lookup column was not updating even after saving the item. There was no erro...