1

I have created a web part and done some personalization. Deployed the web part. Using administrator privilege I have added the web part to a site page. My problem is users under read permission currently not able to personalize the web part.There is no ‘Personalize this page’ link at top corner. Please help

public class CustPersonal : WebPart
    {
        private int _intFontSize;

        private string _strLblData = "";

        [Personalizable(PersonalizationScope.User),
        WebBrowsable(true),
        WebDisplayName("Personalize your Label data"),
        WebDescription("This label is a personalized webpart")]

        public string LabelData
        {
            get { return _strLblData; }
            set { _strLblData = value; }
        }

        [Personalizable(PersonalizationScope.Shared),
        WebBrowsable(true),
        WebDisplayName("Customize font size for every one"),
        WebDescription("This label is a customized webpart")]

        public int FontSizeValue
        {
            get { return _intFontSize; }
            set { _intFontSize = value; }
        } 
        protected override void CreateChildControls()
        {           
            base.CreateChildControls();
            Label lbl = new Label();
            lbl.Text = _strLblData;
            lbl.Font.Size = _intFontSize;
            this.Controls.Add(lbl);
        }
    }

1 Answer 1

2

The following considerations must be applied for the web part which user without permission Add and Customize Pages can add/remove or modify.

1.In SP 2010 TypeName attribute of the tag should use particular type name instead wildcard. 2.Attribute Safe set to "True" 3.Attribute SafeAgainstScript also set to "True" And SafeControl tag will look similar to this:

    <SafeControl Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral,      PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.WebPartPages" TypeName="ListViewWebPart" Safe="True" SafeAgainstScript="True" />

However VS 2010 by default generate wildcard "*" for the TypeName attribute, and "False" value for the SafeAgainstScript attribute of the Web Part item. So you need change in the Web Part item Properties Safe Control Entries collection entry with particular type name and "SafeAgainstScript" property right value.

check below url : http://www.kiruthik.com/2010/10/05/YouDontHaveAddAndCustomizePagesPermissionsRequiredToPerformThisAction.aspx

4
  • what to give as TypeName?
    – anish
    Dec 5, 2013 at 8:57
  • The type name of the ASPX control or Web Part.
    – Amit
    Dec 5, 2013 at 9:07
  • I have given TypeName="*" and SafeAgainstScript="True".Now working fine.By editing webpart it is possible to personalize.But "Personalize this page" link is not displaying
    – anish
    Dec 5, 2013 at 9:12
  • 1
    @anish i got this one more useful blog by JamieMcAllister Personalization in SharePoint 2010 link
    – Amit
    Dec 5, 2013 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.