Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

With this attributes decorating the Properties of a Web Part...

[WebBrowsable(true)]
[Category("Common Settings")]
[WebDisplayName("Show tab header")]
[WebDescription("Show tab header for the News Feed webpart")]
[Personalizable(PersonalizationScope.Shared)]

... is the [WebPartStorage(Storage.Shared)] implied when using the above attributes (PersonalizationScope.Shared), or are the value stored for each user if Storage.Shared is not explicitly set.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

PersonalizationScope.Shared indicates that the property is not personalizable. PersonalizationScope.User indicates that the property is personalizable.

Also, from the documentation for WebPartStorage: If you are developing SharePoint 2003 Web parts, you can apply both the PersonalizableAttribute attribute and the WebPartStorageAttribute attribute to change the serialization method. However, for later versions of SharePoint, the PersonalizableAttribute attribute is the default option used to deserialize the web part before using the WebPartStorageAttribute attribute.

share|improve this answer
    
To clarify: In Sharepoint 2010. Do we need to add [WebPartStorage(Storage.Shared)] to store the value only once? If we skip it will the value be stored seperatly for each user? –  HaavardMeling May 10 '11 at 12:15
    
+1, and I'd like to add: actually, webparts were born in SharePoint 2003, and in 2005 they were moved into ASP.Net framework 2.0. From that time, System.Web.UI.WebControls.WebParts is more preferrable to use, and Microsoft.SharePoint.WebPartPages is usually not recommended (for example, see remarks section of this MSDN article: msdn.microsoft.com/en-us/library/… article) –  Andrey Markeev May 10 '11 at 12:23
1  
In SharePoint 2010 you do not need to use the WebPartStorage attribute. SharePoint can get all the information it needs from the Personalizable attribute. When using the Personalizable attribute, you should pass PersonalizationScope.Shared to the constructor to prevent personalization (i.e. values being stored for each user). –  Rob Windsor May 10 '11 at 12:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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